Class: Logbook::Page
- Inherits:
-
Object
- Object
- Logbook::Page
- Defined in:
- lib/logbook/page.rb
Instance Attribute Summary collapse
-
#entries ⇒ Object
Returns the value of attribute entries.
-
#properties ⇒ Object
Returns the value of attribute properties.
Instance Method Summary collapse
- #add(entry) ⇒ Object
- #entry_at(line_number) ⇒ Object
-
#initialize ⇒ Page
constructor
A new instance of Page.
Constructor Details
#initialize ⇒ Page
Returns a new instance of Page.
5 6 7 |
# File 'lib/logbook/page.rb', line 5 def initialize @entries = [] end |
Instance Attribute Details
#entries ⇒ Object
Returns the value of attribute entries.
3 4 5 |
# File 'lib/logbook/page.rb', line 3 def entries @entries end |
#properties ⇒ Object
Returns the value of attribute properties.
3 4 5 |
# File 'lib/logbook/page.rb', line 3 def properties @properties end |
Instance Method Details
#add(entry) ⇒ Object
9 10 11 |
# File 'lib/logbook/page.rb', line 9 def add(entry) entries.unshift(entry) end |
#entry_at(line_number) ⇒ Object
13 14 15 |
# File 'lib/logbook/page.rb', line 13 def entry_at(line_number) entries.find { |entry| entry.line_number <= line_number } end |