Class: Phi::Losophy::Pages

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable, Logger
Defined in:
lib/phi/losophy/pages.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logger

#log

Constructor Details

#initialize(losophy) ⇒ Pages

Returns a new instance of Pages.



10
11
12
13
# File 'lib/phi/losophy/pages.rb', line 10

def initialize(losophy)
  @losophy = losophy
  @pages   = []
end

Instance Attribute Details

#browsedObject (readonly)

Returns the value of attribute browsed.



8
9
10
# File 'lib/phi/losophy/pages.rb', line 8

def browsed
  @browsed
end

#losophyObject (readonly)

Returns the value of attribute losophy.



8
9
10
# File 'lib/phi/losophy/pages.rb', line 8

def losophy
  @losophy
end

#pagesObject (readonly)

Returns the value of attribute pages.



8
9
10
# File 'lib/phi/losophy/pages.rb', line 8

def pages
  @pages
end

Instance Method Details

#current_pageObject



19
20
21
# File 'lib/phi/losophy/pages.rb', line 19

def current_page
  @current_page || self.current_page = first_page
end

#eachObject



15
16
17
# File 'lib/phi/losophy/pages.rb', line 15

def each 
  yield self.next until current_page.philosophy?
end

#nextObject



23
24
25
26
27
# File 'lib/phi/losophy/pages.rb', line 23

def next
  infinite_loop!
  max_pages!
  self.current_page = current_page.next
end