From 9b42cd8cc1d52e5a8d80b67b17e5887c15e90904 Mon Sep 17 00:00:00 2001 From: Leon Breedt Date: Tue, 5 Apr 2005 16:00:28 +0000 Subject: add API::Method#expects_to_hash convenience as well git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1092 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionwebservice/lib/action_web_service/api.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'actionwebservice/lib') diff --git a/actionwebservice/lib/action_web_service/api.rb b/actionwebservice/lib/action_web_service/api.rb index edc2ff17f4..0ff1671144 100644 --- a/actionwebservice/lib/action_web_service/api.rb +++ b/actionwebservice/lib/action_web_service/api.rb @@ -192,6 +192,15 @@ module ActionWebService # :nodoc: -1 end + # Returns a hash keyed by parameter name for the given + # parameter list + def expects_to_hash(params) + return {} if @expects.nil? + h = {} + @expects.zip(params){ |type, param| h[type.name] = param } + h + end + # String representation of this method def to_s fqn = "" -- cgit v1.2.3