Class: MechanizeContent::Parser
- Inherits:
-
Object
- Object
- MechanizeContent::Parser
- Defined in:
- lib/mechanize_content.rb
Instance Attribute Summary collapse
-
#pages ⇒ Object
Returns the value of attribute pages.
Instance Method Summary collapse
- #best_image ⇒ Object
- #best_image_iphone ⇒ Object
- #best_text ⇒ Object
- #best_title ⇒ Object
-
#initialize(*args) ⇒ Parser
constructor
A new instance of Parser.
Constructor Details
Instance Attribute Details
#pages ⇒ Object
Returns the value of attribute pages.
11 12 13 |
# File 'lib/mechanize_content.rb', line 11 def pages @pages end |
Instance Method Details
#best_image ⇒ Object
25 26 27 |
# File 'lib/mechanize_content.rb', line 25 def best_image @pages.map{|page| page.image}.compact.first end |
#best_image_iphone ⇒ Object
29 30 31 |
# File 'lib/mechanize_content.rb', line 29 def best_image_iphone @pages.map{|page| page.image_iphone}.compact.first end |
#best_text ⇒ Object
21 22 23 |
# File 'lib/mechanize_content.rb', line 21 def best_text @pages.map{|page| page.text}.compact.first end |
#best_title ⇒ Object
17 18 19 |
# File 'lib/mechanize_content.rb', line 17 def best_title @pages.map{|page| page.title}.compact.first || @pages.first.url end |