Closed prometh07 closed 5 years ago
ahh interesting. do you have an example of such a file? I've never seen something like that so far. What is the spec/content of those? if they follow some standard maybe we can add proper parsing of those?
PRs are generally welcome!
Take a look at https://github.com/WoLpH/mt940/commit/e4d36fe165bd1059c7fa2d5dbeeaa58fa41fa394 and ftp://ftp.kamsoft.pl/pub/KS-FKW/Pomoce/MT940/PekaoBIZNES24_MC.pdf or https://github.com/WoLpH/mt940/issues/23
Here's an example from the last link:
:20:STARTUMS
:25:1222333444
:28:1/1
:NS:22Test GmbH
23Testkonto
240,800
25010102311202
3037010000
...
ok, interesting... "non-swift" .
I think we should add proper support for that then.
It should be possible to simply add a new parser as described here). And adjust the regex here to support non decimal tags.
A PR would be great! I'm happy to help if you have questions.
Well, so I made a tiny commit. But don't you think it would beneficial to emphasize the fact that newly defined custom field parsers are automatically added to Field.parsers
hash (ie. they are used when parsing a file)? Because right now it's not entirely clear or convincing.
thanks, will look at it asap. regarding your comment: you mean that should me mentioned clearly in the readme? Just looked at the readme and you're right it is not clear that it will automatically used. -> ruby magic :)
fixed by merging #26, thanks @prometh07 👍
Scenario: I'm trying to parse a file with a header containing a line with a custom, non-digit tag, eg.
:NS:some-description
.Available options:
Cmxl.config[:raise_line_format_errors] = false
None of these is helpful. However, I think there are some solutions to the problem:
self.parse(line)
insidefield.rb
I can make a PR, if you want so.