Class: Journala::Row
- Inherits:
-
Object
- Object
- Journala::Row
- Defined in:
- lib/journala/row.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#amount ⇒ Object
Returns the value of attribute amount.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Row
constructor
A new instance of Row.
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(attrs = {}) ⇒ Row
Returns a new instance of Row.
6 7 8 9 10 |
# File 'lib/journala/row.rb', line 6 def initialize(attrs={}) attrs.each do |k,v| self.send("#{k}=", v) end end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
3 4 5 |
# File 'lib/journala/row.rb', line 3 def account @account end |
#amount ⇒ Object
Returns the value of attribute amount.
4 5 6 |
# File 'lib/journala/row.rb', line 4 def amount @amount end |
Instance Method Details
#to_s ⇒ Object
20 21 22 23 |
# File 'lib/journala/row.rb', line 20 def to_s spaces = ' ' * [(70 - @account.length - @amount.length), 5].max " #{@account}#{spaces}#{@amount}" end |
#valid? ⇒ Boolean
16 17 18 |
# File 'lib/journala/row.rb', line 16 def valid? @account.present? && @amount.present? end |