You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ONIX spec requires all dates to be formatted as YYYYMMDD.
I handle the to_xml conversion from a Date class to a string by defining a lambda method and passing it to the attribute using the :to_xml option.
For marshalling xml strings into Date objects, I was using ":as => Date", but that would raise an exception when I tried to parse a file that containing invalid dates ( like "00000000"). To define my own XML->Ruby process, I have to pass a block into the attribute definition. This works, but has lead to some duplication.
It would be awesome if I could pass a lambda object into :as, just like I can with :to_xml.
The text was updated successfully, but these errors were encountered:
For reference, the Product class in my ONIX library: http://github.com/yob/onix/blob/master/lib/onix/product.rb, lines 31-37.
The ONIX spec requires all dates to be formatted as YYYYMMDD.
I handle the to_xml conversion from a Date class to a string by defining a lambda method and passing it to the attribute using the :to_xml option.
For marshalling xml strings into Date objects, I was using ":as => Date", but that would raise an exception when I tried to parse a file that containing invalid dates ( like "00000000"). To define my own XML->Ruby process, I have to pass a block into the attribute definition. This works, but has lead to some duplication.
It would be awesome if I could pass a lambda object into :as, just like I can with :to_xml.
The text was updated successfully, but these errors were encountered: