Class: Ferrexi

Inherits:
Object
  • Object
show all
Defined in:
lib/ferrexi.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, debug: false) ⇒ Ferrexi

Returns a new instance of Ferrexi.



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ferrexi.rb', line 13

def initialize(url, debug: false)
  
  browser = Ferrum::Browser.new
  browser.goto(url)
  
  # without the following statement the DOM probably won't have loaded yet.
  # As a result, falls back to returning the original document source
  
  browser.network.wait_for_idle 
  
  @to_doc = Rexle.new(browser.body, debug: debug)
  
end

Instance Attribute Details

#to_docObject (readonly)

Returns the value of attribute to_doc.



11
12
13
# File 'lib/ferrexi.rb', line 11

def to_doc
  @to_doc
end