public
Last active

Class of alias nodes differs from class of anchor nodes in Psych

  • Download Gist
example.yaml
YAML
1 2
:original: &id001 2012-04-14 11:00:00 Z
:alias: *id001
irb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# Ruby 1.9.2-p290
require 'yaml'
 
from_syck = YAML.load_file("example.yaml")
 
from_syck[:original].class # => Time
from_syck[:alias].class # => Time
 
require 'psych'
YAML::ENGINE.yamler = 'psych'
 
from_psych = YAML.load_file("example.yaml")
 
from_psych[:original].class # => Time
from_psych[:alias].class # => String

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.