Class: Guevara::Entry
- Inherits:
-
Row
- Object
- Row
- Guevara::Entry
show all
- Defined in:
- lib/guevara/entry.rb
Constant Summary
collapse
- ACCOUNT_TYPE_CODE =
{ 'checking' => '2', 'saving' => '3' }
- TRANSACTION_TYPE_CODE =
{ 'credit' => '2', 'debit' => '7' }
Instance Attribute Summary
Attributes inherited from Row
#attributes
Instance Method Summary
collapse
Methods inherited from Row
#default_attributes, #initialize, #to_s
Constructor Details
This class inherits a constructor from Guevara::Row
Instance Method Details
#fields ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/guevara/entry.rb', line 13
def fields
["6%<transaction_code>2d",
"%<routing_number>09d",
"%<account_number>-17.17s",
"%<amount>010d",
"%<id>-15.15s",
"%<name>-22.22s",
" 1",
"%<origin_id>8d",
"%<number>07d"]
end
|
9
10
11
|
# File 'lib/guevara/entry.rb', line 9
def format_attributes
attributes[:transaction_code] ||= transaction_code
end
|
#transaction_code ⇒ Object
25
26
27
28
|
# File 'lib/guevara/entry.rb', line 25
def transaction_code
ACCOUNT_TYPE_CODE[attributes[:account_type]] +
TRANSACTION_TYPE_CODE[attributes[:type]]
end
|