Skip to content

Instantly share code, notes, and snippets.

@ejames
Created July 2, 2012 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ejames/3034085 to your computer and use it in GitHub Desktop.
Save ejames/3034085 to your computer and use it in GitHub Desktop.
Class of alias nodes differs from class of anchor nodes in Psych
:original: &id001 2012-04-14 11:00:00 Z
:alias: *id001
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment