Class: Transaction
- Inherits:
-
Object
- Object
- Transaction
- Defined in:
- lib/cartolify/transaction.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#saldo ⇒ Object
readonly
Returns the value of attribute saldo.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #income? ⇒ Boolean
-
#initialize(hash) ⇒ Transaction
constructor
A new instance of Transaction.
- #outcome? ⇒ Boolean
Constructor Details
#initialize(hash) ⇒ Transaction
Returns a new instance of Transaction.
4 5 6 7 8 9 |
# File 'lib/cartolify/transaction.rb', line 4 def initialize(hash) @total = hash[:total] @date = hash[:date] @description = clean_utf(hash[:description]) @saldo = hash[:saldo] end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
2 3 4 |
# File 'lib/cartolify/transaction.rb', line 2 def date @date end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
2 3 4 |
# File 'lib/cartolify/transaction.rb', line 2 def description @description end |
#saldo ⇒ Object (readonly)
Returns the value of attribute saldo.
2 3 4 |
# File 'lib/cartolify/transaction.rb', line 2 def saldo @saldo end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
2 3 4 |
# File 'lib/cartolify/transaction.rb', line 2 def total @total end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
2 3 4 |
# File 'lib/cartolify/transaction.rb', line 2 def type @type end |
Instance Method Details
#income? ⇒ Boolean
11 12 13 |
# File 'lib/cartolify/transaction.rb', line 11 def income? total > 0 end |
#outcome? ⇒ Boolean
15 16 17 |
# File 'lib/cartolify/transaction.rb', line 15 def outcome? total < 0 end |