Look at this case:
ruby 1.9.2p0 (2010-08-18 version 29036) [i686-linux]
irb(main):006:0> YAML::ENGINE.yamler = "psych" => "psych" irb(main):007:0> '8902-20-13'.to_yaml ArgumentError: invalid date from /usr/local/lib/ruby/1.9.1/date.rb:1022:in `new_by_frags' from /usr/local/lib/ruby/1.9.1/date.rb:1046:in `strptime' from /usr/local/lib/ruby/1.9.1/psych/scalar_scanner.rb:45:in `tokenize' from /usr/local/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:191:in `visit_String' from /usr/local/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:63:in `accept' from /usr/local/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:36:in `<<' from /usr/local/lib/ruby/1.9.1/psych.rb:165:in `dump' from /usr/local/lib/ruby/1.9.1/psych/core_ext.rb:13:in `psych_to_yaml' irb(main):008:0> YAML::ENGINE.yamler = "syck" => "syck" irb(main):009:0> '8902-20-13'.to_yaml => "--- \"8902-20-13\"\n"
When I use a parser and I need to format a string that is vaguely like a date, it throws an exception because it considers it to be a date string. Using syck this problem does not occur.
Does anyone have an idea?
source share