Class: Financo::Transaction
- Inherits:
-
Struct
- Object
- Struct
- Financo::Transaction
- Defined in:
- lib/financo/transaction.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#commodity ⇒ Object
Returns the value of attribute commodity.
-
#date ⇒ Object
Returns the value of attribute date.
-
#description ⇒ Object
Returns the value of attribute description.
-
#exchange_rate ⇒ Object
Returns the value of attribute exchange_rate.
-
#id ⇒ Object
Returns the value of attribute id.
-
#original_commodity ⇒ Object
Returns the value of attribute original_commodity.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account
4 5 6 |
# File 'lib/financo/transaction.rb', line 4 def account @account end |
#amount ⇒ Object
Returns the value of attribute amount
4 5 6 |
# File 'lib/financo/transaction.rb', line 4 def amount @amount end |
#comment ⇒ Object
Returns the value of attribute comment
4 5 6 |
# File 'lib/financo/transaction.rb', line 4 def comment @comment end |
#commodity ⇒ Object
Returns the value of attribute commodity
4 5 6 |
# File 'lib/financo/transaction.rb', line 4 def commodity @commodity end |
#date ⇒ Object
Returns the value of attribute date
4 5 6 |
# File 'lib/financo/transaction.rb', line 4 def date @date end |
#description ⇒ Object
Returns the value of attribute description
4 5 6 |
# File 'lib/financo/transaction.rb', line 4 def description @description end |
#exchange_rate ⇒ Object
Returns the value of attribute exchange_rate
4 5 6 |
# File 'lib/financo/transaction.rb', line 4 def exchange_rate @exchange_rate end |
#id ⇒ Object
Returns the value of attribute id
4 5 6 |
# File 'lib/financo/transaction.rb', line 4 def id @id end |
#original_commodity ⇒ Object
Returns the value of attribute original_commodity
4 5 6 |
# File 'lib/financo/transaction.rb', line 4 def original_commodity @original_commodity end |
#status ⇒ Object
Returns the value of attribute status
4 5 6 |
# File 'lib/financo/transaction.rb', line 4 def status @status end |
Instance Method Details
#to_s ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/financo/transaction.rb', line 16 def to_s StringIO.open do |s| s.puts "#{Time.at(date / 1000).strftime('%Y-%m-%d')} * #{description}" s.puts " ; #{comment}" unless comment.nil? || comment.strip.empty? s << " #{format('%-50s', account)} #{amount} #{commodity}" s << " {#{exchange_rate} #{original_commodity}}" if original_commodity && commodity != original_commodity s.puts s.puts " ; TransactionId: #{id}" s.string end end |