class MT940
this is a beautification wrapper around the low-level MT940.parse
command. use it in order to make dealing with the data easier
Constants
- VERSION
-
MT940
version
Public Class Methods
Source
# File lib/mt940.rb, line 280 def parse(text) new_text = text.encode('UTF-8').strip new_text << "\r\n" if new_text.end_with?('-') raw_sheets = new_text.split(/^-\s*\r\n/).map do |sheet| sheet.gsub(/\r\n(?!:\d{2}\w?:)/, '') end raw_sheets.map { |raw_sheet| parse_sheet(raw_sheet) } end
Private Class Methods
Source
# File lib/mt940.rb, line 291 def parse_sheet(sheet) lines = sheet.split("\r\n") lines.reject { |line| line.empty? }.map { |line| Field.for(line) } end