diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-02-12 21:31:28 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-02-12 21:31:28 +0000 |
commit | 35b74de7703515cf93da2d3e850702f58a2a6f48 (patch) | |
tree | ce9d927efbeea1eeae08a9ed2604fe38cdcb3741 /actionpack/lib | |
parent | 5f2292ce39ae7dd41d45c8cdd15719c4845f2bc6 (diff) | |
download | rails-35b74de7703515cf93da2d3e850702f58a2a6f48.tar.gz rails-35b74de7703515cf93da2d3e850702f58a2a6f48.tar.bz2 rails-35b74de7703515cf93da2d3e850702f58a2a6f48.zip |
Use real assigns instead of a method call [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3591 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/prototype_helper.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index a953eab659..9a65fee855 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -671,10 +671,6 @@ module ActionView @generator = generator @generator << root end - - def assign(variable, value) - append_to_function_chain! "#{variable} = #{@generator.send(:javascript_object_for, value)}" - end def replace_html(*options_for_render) call 'update', @generator.render(*options_for_render) @@ -685,12 +681,22 @@ module ActionView end private + def method_missing(method, *arguments) + if method.to_s =~ /(.*)=$/ + assign($1, arguments.first) + else + call(method, *arguments) + end + end + def call(function, *arguments) append_to_function_chain!("#{function}(#{@generator.send(:arguments_for_call, arguments)})") self end - - alias_method :method_missing, :call + + def assign(variable, value) + append_to_function_chain! "#{variable} = #{@generator.send(:javascript_object_for, value)}" + end def function_chain @function_chain ||= @generator.instance_variable_get("@lines") |