Class: TSMAccounting::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/tsm-accounting.rb

Overview

Database

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#idObject (readonly)

Returns the value of attribute id.



194
195
196
# File 'lib/tsm-accounting.rb', line 194

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



194
195
196
# File 'lib/tsm-accounting.rb', line 194

def name
  @name
end

#transactionsObject (readonly)

Returns the value of attribute transactions.



194
195
196
# File 'lib/tsm-accounting.rb', line 194

def transactions
  @transactions
end