From 4e7c6f58fb14ad8783062303191eebed7699965b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 20 Mar 2006 03:32:28 +0000 Subject: Added option to String#camelize to generate lower-cased camel case by passing in :lower, like "super_man".camelize(:lower) # => "superMan" [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3986 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/prototype_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index 3d15f2ecfd..efa3e7a14a 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -738,7 +738,7 @@ module ActionView if method.to_s =~ /(.*)=$/ assign($1, arguments.first) else - call("#{method.to_s.first}#{method.to_s.camelize[1..-1]}", *arguments) + call("#{method.to_s.camelize(:lower)}", *arguments) end end @@ -865,7 +865,7 @@ module ActionView method_args = arguments_for_call options[:method_args] # foo, bar, function method_args << ', ' unless method_args.blank? add_variable_assignment!(options[:variable]) if options[:variable] - append_enumerable_function!("#{enumerable.to_s.first}#{enumerable.to_s.camelize[1..-1]}(#{method_args}function(#{yield_args}) {") + append_enumerable_function!("#{enumerable.to_s.camelize(:lower)}(#{method_args}function(#{yield_args}) {") # only yield as many params as were passed in the block yield *options[:yield_args].collect { |p| JavaScriptVariableProxy.new(@generator, p) }[0..block.arity-1] add_return_statement! if options[:return] -- cgit v1.2.3