Class: MT940::StatementLine

Inherits:
Field
  • Object
show all
Defined in:
lib/mt940.rb

Overview

61

Constant Summary collapse

CONTENT =
/^(\d{6})(\d{4})?(C|D|RC|RD)\D?(\d{1,12},\d{0,2})((?:N|F).{3})(NONREF|.{0,16})(?:$|\/\/)(.*)/

Constants inherited from Field

Field::DATE, Field::LINE, Field::SHORT_DATE

Instance Attribute Summary collapse

Attributes inherited from Field

#content, #modifier

Instance Method Summary collapse

Methods inherited from Field

for, #initialize

Constructor Details

This class inherits a constructor from MT940::Field

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



181
182
183
# File 'lib/mt940.rb', line 181

def amount
  @amount
end

#dateObject (readonly)

Returns the value of attribute date.



181
182
183
# File 'lib/mt940.rb', line 181

def date
  @date
end

#entry_dateObject (readonly)

Returns the value of attribute entry_date.



181
182
183
# File 'lib/mt940.rb', line 181

def 
  @entry_date
end

#funds_codeObject (readonly)

Returns the value of attribute funds_code.



181
182
183
# File 'lib/mt940.rb', line 181

def funds_code
  @funds_code
end

#referenceObject (readonly)

Returns the value of attribute reference.



181
182
183
# File 'lib/mt940.rb', line 181

def reference
  @reference
end

#swift_codeObject (readonly)

Returns the value of attribute swift_code.



181
182
183
# File 'lib/mt940.rb', line 181

def swift_code
  @swift_code
end

#transaction_descriptionObject (readonly)

Returns the value of attribute transaction_description.



181
182
183
# File 'lib/mt940.rb', line 181

def transaction_description
  @transaction_description
end

Instance Method Details

#parse_content(content) ⇒ Object



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/mt940.rb', line 185

def parse_content(content)
  content.match(CONTENT)

  raw_date       = $1
   = $2
  @funds_code =
    case $3
    when 'C'
      :credit
    when 'D'
      :debit
    when 'RC'
      :return_credit
    when 'RD'
      :return_debit
    end

  @amount = parse_amount_in_cents($4)
  @swift_code = $5
  @reference = $6
  @transaction_description = $7

  @date = parse_date(raw_date)
  @entry_date = (, @date) if 
end

#value_dateObject



211
212
213
# File 'lib/mt940.rb', line 211

def value_date
  @date
end