Class: UOB::Payroll::TXTFile::Row
- Inherits:
-
Object
- Object
- UOB::Payroll::TXTFile::Row
- Includes:
- ActiveModel::Model, TxtData::TxtDataRowDSL
- Defined in:
- lib/uob/payroll/txt_file/row.rb
Instance Attribute Summary collapse
-
#account_name ⇒ Object
readonly
Returns the value of attribute account_name.
-
#account_number ⇒ Object
readonly
Returns the value of attribute account_number.
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#bic_code ⇒ Object
readonly
Returns the value of attribute bic_code.
Instance Method Summary collapse
- #end_to_end_id ⇒ Object
- #formatted_amount ⇒ Object
-
#initialize(bic_code:, account_number:, account_name:, amount:) ⇒ Row
constructor
A new instance of Row.
- #receiving_account_name ⇒ Object
- #receiving_account_number ⇒ Object
- #receiving_bic_code ⇒ Object
Methods included from TxtData::TxtDataRowDSL
Constructor Details
#initialize(bic_code:, account_number:, account_name:, amount:) ⇒ Row
Returns a new instance of Row.
29 30 31 32 33 34 35 36 |
# File 'lib/uob/payroll/txt_file/row.rb', line 29 def initialize(bic_code:, account_number:, account_name:, amount:) @bic_code = bic_code @account_number = account_number @account_name = account_name @amount = amount.is_a?(String) ? BigDecimal(amount) : amount raise Errors::Invalid, errors..to_sentence unless valid? end |
Instance Attribute Details
#account_name ⇒ Object (readonly)
Returns the value of attribute account_name.
21 22 23 |
# File 'lib/uob/payroll/txt_file/row.rb', line 21 def account_name @account_name end |
#account_number ⇒ Object (readonly)
Returns the value of attribute account_number.
21 22 23 |
# File 'lib/uob/payroll/txt_file/row.rb', line 21 def account_number @account_number end |
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
21 22 23 |
# File 'lib/uob/payroll/txt_file/row.rb', line 21 def amount @amount end |
#bic_code ⇒ Object (readonly)
Returns the value of attribute bic_code.
21 22 23 |
# File 'lib/uob/payroll/txt_file/row.rb', line 21 def bic_code @bic_code end |
Instance Method Details
#end_to_end_id ⇒ Object
54 55 56 |
# File 'lib/uob/payroll/txt_file/row.rb', line 54 def end_to_end_id 'SALARY' end |
#formatted_amount ⇒ Object
38 39 40 |
# File 'lib/uob/payroll/txt_file/row.rb', line 38 def formatted_amount (format '%014.2f', amount.round(2)).gsub('.','') end |
#receiving_account_name ⇒ Object
50 51 52 |
# File 'lib/uob/payroll/txt_file/row.rb', line 50 def receiving_account_name String(account_name).ljust 140 end |
#receiving_account_number ⇒ Object
46 47 48 |
# File 'lib/uob/payroll/txt_file/row.rb', line 46 def receiving_account_number account_number end |
#receiving_bic_code ⇒ Object
42 43 44 |
# File 'lib/uob/payroll/txt_file/row.rb', line 42 def receiving_bic_code String(bic_code).upcase end |