Class: Logbook::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/logbook/page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePage

Returns a new instance of Page.



5
6
7
# File 'lib/logbook/page.rb', line 5

def initialize
  @entries = []
end

Instance Attribute Details

#entriesObject

Returns the value of attribute entries.



3
4
5
# File 'lib/logbook/page.rb', line 3

def entries
  @entries
end

#propertiesObject

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