Class: MT940::AccountIdentification

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

Overview

25

Constant Summary collapse

CONTENT =

any 35 chars (35x from the docs)

/(.{1,35})/

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object

fail over to the old Account class



95
96
97
98
99
100
101
102
103
104
# File 'lib/mt940.rb', line 95

def method_missing(method, *args, &block)
  @fail_over_implementation ||= Account.new(@modifier, @content)
  value = @fail_over_implementation.send(method)
  warn "[DEPRECATION]:"
  warn "You used '#{method}' on the Account/AccountIdentification class"
  warn "This field is not part of the MT940 specification but implementation specific"
  warn "Please use the 'account_identifier' and parse yourself."

  value
end

Instance Attribute Details

#account_identifierObject (readonly)

Returns the value of attribute account_identifier.



86
87
88
# File 'lib/mt940.rb', line 86

def 
  @account_identifier
end

Instance Method Details

#parse_content(content) ⇒ Object



89
90
91
92
# File 'lib/mt940.rb', line 89

def parse_content(content)
  content.match(CONTENT)
  @account_identifier = $1
end