aboutsummaryrefslogtreecommitdiffstats
path: root/actionwebservice/lib
diff options
context:
space:
mode:
authorLeon Breedt <bitserf@gmail.com>2005-04-05 15:41:04 +0000
committerLeon Breedt <bitserf@gmail.com>2005-04-05 15:41:04 +0000
commit7a5bac1de0c6a851d5e2a224629ee0a135db6bc2 (patch)
tree5d171d913d22ea07966fd82986d85c5b3e3f07e3 /actionwebservice/lib
parent361dcad8fd022065bc38fd557b0ec02d6e3f1a0b (diff)
downloadrails-7a5bac1de0c6a851d5e2a224629ee0a135db6bc2.tar.gz
rails-7a5bac1de0c6a851d5e2a224629ee0a135db6bc2.tar.bz2
rails-7a5bac1de0c6a851d5e2a224629ee0a135db6bc2.zip
add API::Method#expects_index_of helper to get the index of
a named parameter git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1091 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice/lib')
-rw-r--r--actionwebservice/lib/action_web_service/api.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/actionwebservice/lib/action_web_service/api.rb b/actionwebservice/lib/action_web_service/api.rb
index 4548856d86..edc2ff17f4 100644
--- a/actionwebservice/lib/action_web_service/api.rb
+++ b/actionwebservice/lib/action_web_service/api.rb
@@ -182,6 +182,16 @@ module ActionWebService # :nodoc:
@caster.cast_returns(return_value)
end
+ # Returns the index of the first expected parameter
+ # with the given name
+ def expects_index_of(param_name)
+ return -1 if @expects.nil?
+ (0..(@expects.length-1)).each do |i|
+ return i if @expects[i].name.to_s == param_name.to_s
+ end
+ -1
+ end
+
# String representation of this method
def to_s
fqn = ""