Class: Mike::Document

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

Overview

Env

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Document

Returns a new instance of Document.



17
18
19
20
21
22
23
24
25
# File 'lib/mike.rb', line 17

def initialize(url)
  @url  = url
  @html = load_url(@url)
  @dom  = Hpricot(@html)
  @js   = Mustang::Context.new

  prepare_context
  process_scripts
end

Instance Attribute Details

#domObject (readonly)

Returns the value of attribute dom.



14
15
16
# File 'lib/mike.rb', line 14

def dom
  @dom
end

#htmlObject (readonly)

Returns the value of attribute html.



15
16
17
# File 'lib/mike.rb', line 15

def html
  @html
end

#jsObject (readonly)

Returns the value of attribute js.



12
13
14
# File 'lib/mike.rb', line 12

def js
  @js
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

Instance Method Details

#scriptsObject



27
28
29
# File 'lib/mike.rb', line 27

def scripts
  (@dom/"//script")
end