Class: Bowline::JQuery

Inherits:
Object show all
Defined in:
lib/bowline/jquery.rb

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, args) ⇒ Object

Equivalent to: $.foo()



4
5
6
# File 'lib/bowline/jquery.rb', line 4

def method_missing(sym, args)
  self.class.dollar.send(sym, *args)
end

Class Method Details

.bind(event, fun, data) ⇒ Object

For binding global events Equivalent to: $(‘body’).bind()



16
17
18
# File 'lib/bowline/jquery.rb', line 16

def bind(event, fun, data)
  for_element("body").bind(event, data, fun)
end

.bowlineObject

Equivalent to: $.bowline



26
27
28
# File 'lib/bowline/jquery.rb', line 26

def bowline
  dollar.bowline
end

.dollarObject

Equivalent to: $



21
22
23
# File 'lib/bowline/jquery.rb', line 21

def dollar
  Bowline::js.send("jQuery")
end

.for_element(el) ⇒ Object

Equivalent to: $(‘#item_id’)



10
11
12
# File 'lib/bowline/jquery.rb', line 10

def for_element(el)
  Bowline::js.send("jQuery", el)
end