Class: TSMAccounting::Item
- Inherits:
-
Object
- Object
- TSMAccounting::Item
- Defined in:
- lib/tsm-accounting.rb
Overview
Database
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#transactions ⇒ Object
readonly
Returns the value of attribute transactions.
Instance Method Summary collapse
-
#initialize(item, type) ⇒ Item
constructor
A new instance of Item.
Constructor Details
#initialize(item, type) ⇒ Item
Returns a new instance of Item.
196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/tsm-accounting.rb', line 196 def initialize(item,type) encoded_item, encoded_records = item.split '!' if encoded_item[0,1] == 'x' @id, @name = decode_code(encoded_item) else @id, @name = decode_link(encoded_item) end @transactions = encoded_records.split('@').map {|record| Transaction.new(record,type) } @transactions ||= [] end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
194 195 196 |
# File 'lib/tsm-accounting.rb', line 194 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
194 195 196 |
# File 'lib/tsm-accounting.rb', line 194 def name @name end |
#transactions ⇒ Object (readonly)
Returns the value of attribute transactions.
194 195 196 |
# File 'lib/tsm-accounting.rb', line 194 def transactions @transactions end |