Class: Cmxl::Field
- Inherits:
-
Object
- Object
- Cmxl::Field
- Defined in:
- lib/swifty.rb
Direct Known Subclasses
Class Method Summary collapse
Class Method Details
.parse(line) ⇒ Object
Override for github.com/railslove/cmxl/blob/master/lib/cmxl/field.rb#L46-L53
This ensures that we can parse the header (field 1, 2, and 3) in the SWIFT messages. See the example.swift.txt for an example.
See also ibm.co/1K0zURs
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/swifty.rb', line 28 def self.parse(line) if line.match(/^:(\d{2,2})(\w)?:(.*)$/) tag, modifier, content = $1, $2, $3 Field.parsers[tag.to_s].new(content, modifier, tag) elsif line.match Regexp.new('\d:([^}]+)') # Header basic_header, application_header = $1, $2 Field.parsers['1'].new(basic_header, application_header, '1') else raise LineFormatError, "Wrong line format: #{line.dump}" if Cmxl.config[:raise_line_format_errors] end end |