Class: Journala::Entry
- Inherits:
-
Object
- Object
- Journala::Entry
- Defined in:
- lib/journala/entry.rb
Instance Attribute Summary collapse
-
#confirmed ⇒ Object
Returns the value of attribute confirmed.
-
#date ⇒ Object
Returns the value of attribute date.
-
#description ⇒ Object
Returns the value of attribute description.
-
#rows ⇒ Object
Returns the value of attribute rows.
Instance Method Summary collapse
- #<<(new_row) ⇒ Object
-
#initialize(attrs = {}) ⇒ Entry
constructor
A new instance of Entry.
- #to_s ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Entry
Returns a new instance of Entry.
5 6 7 8 9 10 |
# File 'lib/journala/entry.rb', line 5 def initialize(attrs={}) @rows = [] attrs.each do |k,v| self.send("#{k}=", v) end end |
Instance Attribute Details
#confirmed ⇒ Object
Returns the value of attribute confirmed.
3 4 5 |
# File 'lib/journala/entry.rb', line 3 def confirmed @confirmed end |
#date ⇒ Object
Returns the value of attribute date.
3 4 5 |
# File 'lib/journala/entry.rb', line 3 def date @date end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/journala/entry.rb', line 3 def description @description end |
#rows ⇒ Object
Returns the value of attribute rows.
3 4 5 |
# File 'lib/journala/entry.rb', line 3 def rows @rows end |
Instance Method Details
#<<(new_row) ⇒ Object
12 13 14 |
# File 'lib/journala/entry.rb', line 12 def <<(new_row) @rows << new_row end |
#to_s ⇒ Object
16 17 18 19 |
# File 'lib/journala/entry.rb', line 16 def to_s confirmed_str = @confirmed? " *" : "" %{#{@date}#{confirmed_str} #{@description}\n#{@rows.collect(&:to_s).join("\n")}} end |