Class: Phi::Losophy::Page
- Inherits:
-
Object
- Object
- Phi::Losophy::Page
- Defined in:
- lib/phi/losophy/page.rb,
lib/phi/losophy/page/node.rb
Defined Under Namespace
Classes: Node
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#term ⇒ Object
readonly
Returns the value of attribute term.
Instance Method Summary collapse
-
#initialize(term, connection) ⇒ Page
constructor
A new instance of Page.
- #inspect ⇒ Object
- #next ⇒ Object
- #next_term ⇒ Object
- #philosophy? ⇒ Boolean
Constructor Details
#initialize(term, connection) ⇒ Page
Returns a new instance of Page.
7 8 9 10 |
# File 'lib/phi/losophy/page.rb', line 7 def initialize(term, connection) @term = term @connection = connection end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
5 6 7 |
# File 'lib/phi/losophy/page.rb', line 5 def connection @connection end |
#term ⇒ Object (readonly)
Returns the value of attribute term.
5 6 7 |
# File 'lib/phi/losophy/page.rb', line 5 def term @term end |
Instance Method Details
#inspect ⇒ Object
20 21 22 |
# File 'lib/phi/losophy/page.rb', line 20 def inspect "#<#{self.class.name}:#{term}>" end |
#next ⇒ Object
16 17 18 |
# File 'lib/phi/losophy/page.rb', line 16 def next @next ||= Page.new(next_term, connection) end |
#next_term ⇒ Object
24 25 26 |
# File 'lib/phi/losophy/page.rb', line 24 def next_term Node.new(html.css(selector)).anchor.attr("href")[6..-1] end |
#philosophy? ⇒ Boolean
12 13 14 |
# File 'lib/phi/losophy/page.rb', line 12 def philosophy? term.downcase == "philosophy" end |