Class: MT940
- Inherits:
-
Object
- Object
- MT940
- Defined in:
- lib/mt940/customer_statement_message.rb,
lib/mt940.rb,
lib/mt940/errors.rb,
lib/mt940/version.rb
Overview
this is a beautification wrapper around the low-level MT940.parse command. use it in order to make dealing with the data easier
Defined Under Namespace
Modules: Errors Classes: Account, AccountBalance, AccountIdentification, ClosingBalance, CustomerStatementMessage, Field, FutureValutaBalance, Job, Reference, Statement, StatementLine, StatementLineBundle, StatementLineInformation, ValutaBalance
Constant Summary collapse
- VERSION =
MT940 version
'1.5.2'
- VERSION_ARRAY =
:nodoc:
VERSION.split('.').map(&:to_i)
- VERSION_MAJOR =
:nodoc:
VERSION_ARRAY[0]
- VERSION_MINOR =
:nodoc:
VERSION_ARRAY[1]
- VERSION_BUILD =
:nodoc:
VERSION_ARRAY[2]
Class Method Summary collapse
Class Method Details
.parse(text) ⇒ Object
273 274 275 276 277 278 |
# File 'lib/mt940.rb', line 273 def parse(text) new_text = text.encode('UTF-8').strip new_text << "\r\n" if new_text[-1,1] == '-' raw_sheets = new_text.split(/^-\s*\r\n/).map { |sheet| sheet.gsub(/\r\n(?!:)/, '') } sheets = raw_sheets.map { |raw_sheet| parse_sheet(raw_sheet) } end |