Hi,
I have just created a gem for exporting SAF-T standard audit format Tax for norway. The gem takes an xml and converts it into struct, and it can take structs and create xml from it.
rubygem link saft | RubyGems.org | your community gem host
source code GitHub - dodoas/ruby-saft: gem for assist working with SAF-T (Standard Audit File for Tax)
I wondered if any of you would like to take a look at the gem and give me some ideas to what I can do to improve the code?
I have craed tree types of Audit filed which is root object. I have Strict, Relaxed and Sliced. The idea here was that if you want it to low up as soon as possible you use the Strict version and if you want to have all the errors from the xs, there are quite a lot of validations in the xsd which I havn’t copied, and then Sliced, which just sliced all strings down to max length so if you have a name or address which is too long I would cust cut it.
I thing this might have been a stupid idea to have three root types. I am thinking: maybe I should only have created Relaxed and then created validator with dry validator to ensure the length is propperly, if so I would propbably get better errormessaged then what I do today, as well Is I could introduce more rules which goes across multiple attributes.
Anouther other question I have is: Is it bad to define my own Predicated with Dry::Logic::Predicates.predicate
? What would my alternative solution be?