3 ms·
Oh, this gets even better when passing yaml between versions. In ruby 2.1: irb(main):018:0> "2014-99-99 99:99:99.999999 UTC".to_yaml => "--- 2014-99-9
by viraptor 13y ago
Oh, this gets even better when passing yaml between versions.
In ruby 2.1:
irb(main):018:0> "2014-99-99 99:99:99.999999 UTC".to_yaml
=> "--- 2014-99-99 99:99:99.999999 UTC\n...\n"
Send it to ruby 1.9:
irb(main):006:0> YAML.load "--- 2014-99-99 99:99:99.999999 UTC\n...\n"
ArgumentError: argument out of range
from /usr/lib/ruby/1.9.1/psych/scalar_scanner.rb:111:in `utc'
Why did they even try to guess at stuff that's in a string, I can't understand. At least the new version does not explode. (returns a string)
PS: If you think at this point "who would send an incorrect timestamp?", think about some definition of a field validator for example. "format: 9999-99-99 99:99:99.999999 UTC"
- tenderlove 13y ago> Why did they even try to guess at stuff that's in a string, I can't understand. Because that's what the YAML spec says to do. I will try to write better code. :-(