Class: VersatileRJS::Proxy::Jquery::ElementProxy

Inherits:
ElementProxy show all
Defined in:
lib/versatile_rjs/proxy/jquery/element_proxy.rb

Direct Known Subclasses

ElementByIdProxy

Constant Summary collapse

METHODS =
{
  :replace_html => :html,
  :replace => :replaceWith,
  :insert_html => {
    :top => :prepend,
    :bottom => :append
  },
  :value => :val,
  :value= => :val,
  :select => :find
}.freeze

Class Method Summary collapse

Methods inherited from ElementProxy

#args, #hide, #inner_html=, #insert_html, #js_method, #remove, #replace, #replace_html, #show, #toggle, #value, #value=

Methods included from Selectable

#select

Methods included from FrameworkDependent

included

Methods inherited from VersatileRJS::Proxy

#call, #initialize, #method_missing, #to_json

Constructor Details

This class inherits a constructor from VersatileRJS::Proxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class VersatileRJS::Proxy

Class Method Details

.args(method, *args) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/versatile_rjs/proxy/jquery/element_proxy.rb', line 26

def self.args(method, *args)
  case method
  when :insert_html
    args.second
  else
    args
  end
end

.js_method(method, *args) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/versatile_rjs/proxy/jquery/element_proxy.rb', line 17

def self.js_method(method, *args)
  case method
  when :insert_html
    METHODS[method][args.first]
  else
    METHODS[method] || method
  end
end