Class: MT940::Statement

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

Overview

28

Constant Summary collapse

CONTENT =
/^(0|(\d{5,5})\/(\d{2,5}))$/

Constants inherited from Field

Field::DATE, 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

#numberObject (readonly)

Returns the value of attribute number.



96
97
98
# File 'lib/mt940.rb', line 96

def number
  @number
end

#sheetObject (readonly)

Returns the value of attribute sheet.



96
97
98
# File 'lib/mt940.rb', line 96

def sheet
  @sheet
end

Instance Method Details

#parse_content(content) ⇒ Object



100
101
102
103
104
105
106
107
# File 'lib/mt940.rb', line 100

def parse_content(content)
  content.match(CONTENT)
  if $1 == '0'
    @number = @sheet = 0
  else
    @number, @sheet = $2.to_i, $3.to_i
  end
end