Module: Document

Defined in:
lib/red_query/document.rb

Class Method Summary collapse

Class Method Details

.[](css_selector) ⇒ Object



9
10
11
# File 'lib/red_query/document.rb', line 9

def self.[](css_selector)
  self.query(css_selector)
end

.as_elementObject



4
5
6
7
# File 'lib/red_query/document.rb', line 4

def self.as_element
  return @elem if @elem
  @elem = Element.new(`jQuery(document)`)
end

.find(css_selector) ⇒ Object



13
14
15
# File 'lib/red_query/document.rb', line 13

def self.find(css_selector)
  self.query(css_selector)
end

.query(css_selector) ⇒ Object



17
18
19
# File 'lib/red_query/document.rb', line 17

def self.query(css_selector)
  self.as_element.find(css_selector)
end

.ready!Object



25
26
27
# File 'lib/red_query/document.rb', line 25

def self.ready!
  @ready_proc.call if @ready_proc
end

.ready?(&block) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/red_query/document.rb', line 21

def self.ready?(&block)
  @ready_proc = block
end