Class: Pageboy::Page
- Inherits:
-
Object
- Object
- Pageboy::Page
- Defined in:
- lib/pageboy/page.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(turner, items, prev_page_id, next_page_id) ⇒ Page
constructor
A new instance of Page.
- #next ⇒ Object
- #prev ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(turner, items, prev_page_id, next_page_id) ⇒ Page
Returns a new instance of Page.
5 6 7 8 9 10 |
# File 'lib/pageboy/page.rb', line 5 def initialize(turner, items, prev_page_id, next_page_id) @turner = turner @items = items @prev_page_id = prev_page_id @next_page_id = next_page_id end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
3 4 5 |
# File 'lib/pageboy/page.rb', line 3 def items @items end |
Instance Method Details
#each(&block) ⇒ Object
24 25 26 |
# File 'lib/pageboy/page.rb', line 24 def each(&block) @items.each(&block) end |
#next ⇒ Object
16 17 18 |
# File 'lib/pageboy/page.rb', line 16 def next @turner.page(@next_page_id) if @next_page_id end |
#prev ⇒ Object
12 13 14 |
# File 'lib/pageboy/page.rb', line 12 def prev @turner.page(@prev_page_id) if @prev_page_id end |
#to_a ⇒ Object
20 21 22 |
# File 'lib/pageboy/page.rb', line 20 def to_a @items end |