Class: Autoweb::Parser
- Inherits:
-
Object
- Object
- Autoweb::Parser
- Defined in:
- lib/autoweb/page.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
Returns the value of attribute page.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #contaent_parser ⇒ Object
- #doc ⇒ Object
- #go ⇒ Object
-
#initialize(page, hash) ⇒ Parser
constructor
A new instance of Parser.
Constructor Details
#initialize(page, hash) ⇒ Parser
Returns a new instance of Parser.
87 88 89 90 91 92 93 94 |
# File 'lib/autoweb/page.rb', line 87 def initialize(page, hash) @page = page if hash.is_a?(String) @url = hash else @url = page.url(hash) end end |
Instance Attribute Details
#page ⇒ Object
Returns the value of attribute page.
86 87 88 |
# File 'lib/autoweb/page.rb', line 86 def page @page end |
#url ⇒ Object
Returns the value of attribute url.
86 87 88 |
# File 'lib/autoweb/page.rb', line 86 def url @url end |
Instance Method Details
#[](key) ⇒ Object
101 102 103 |
# File 'lib/autoweb/page.rb', line 101 def [](key) contaent_parser[key] end |
#contaent_parser ⇒ Object
105 106 107 |
# File 'lib/autoweb/page.rb', line 105 def contaent_parser @content_parser||=ContentParser.new(doc,page) end |
#doc ⇒ Object
109 110 111 |
# File 'lib/autoweb/page.rb', line 109 def doc @doc||=Hpricot(open(URI.encode url)) end |
#go ⇒ Object
96 97 98 99 |
# File 'lib/autoweb/page.rb', line 96 def go contaent_parser self end |