Class: ActionView::Helpers::JavaScriptProxy

Inherits:
Builder::BlankSlate
  • Object
show all
Defined in:
lib/action_view/helpers/prototype_helper.rb

Overview

Converts chained method calls on DOM proxy elements into JavaScript chains

Instance Method Summary collapse

Constructor Details

#initialize(generator, root = nil) ⇒ JavaScriptProxy

:nodoc:


734
735
736
737
# File 'lib/action_view/helpers/prototype_helper.rb', line 734

def initialize(generator, root = nil)
  @generator = generator
  @generator << root if root
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *arguments) ⇒ Object (private)


740
741
742
743
744
745
746
# File 'lib/action_view/helpers/prototype_helper.rb', line 740

def method_missing(method, *arguments)
  if method.to_s =~ /(.*)=$/
    assign($1, arguments.first)
  else
    call("#{method.to_s.camelize(:lower)}", *arguments)
  end
end