Class: ActionView::Helpers::JavaScriptProxy
- Inherits:
-
Object
- Object
- ActionView::Helpers::JavaScriptProxy
- Defined in:
- lib/action_view/helpers/jquery_helper.rb
Overview
Converts chained method calls on DOM proxy elements into JavaScript chains
Direct Known Subclasses
JavaScriptCollectionProxy, JavaScriptElementProxy, JavaScriptVariableProxy
Instance Method Summary collapse
-
#initialize(generator, root = nil) ⇒ JavaScriptProxy
constructor
A new instance of JavaScriptProxy.
- #is_a?(klass) ⇒ Boolean
Constructor Details
#initialize(generator, root = nil) ⇒ JavaScriptProxy
Returns a new instance of JavaScriptProxy.
730 731 732 733 |
# File 'lib/action_view/helpers/jquery_helper.rb', line 730 def initialize(generator, root = nil) @generator = generator @generator << root.html_safe if root end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *arguments, &block) ⇒ Object (private)
740 741 742 743 744 745 746 |
# File 'lib/action_view/helpers/jquery_helper.rb', line 740 def method_missing(method, *arguments, &block) if method.to_s =~ /(.*)=$/ assign($1, arguments.first) else call("#{method.to_s.camelize(:lower)}", *arguments, &block) end end |
Instance Method Details
#is_a?(klass) ⇒ Boolean
735 736 737 |
# File 'lib/action_view/helpers/jquery_helper.rb', line 735 def is_a?(klass) klass == JavaScriptProxy end |