Ruby objects from YAML
For certain objects if the ISO8601 standard is followed, Ruby will create an instance instead of a string when parsing the value.
"A date can be represented by its year, month and day in ISO8601 order."
For example:
post.txt
title: Updated
date: 2011-09-25
pry(main)> p = YAML.load(File.new('post.txt'))
=> {"title"=>"Updated", "date"=>#<Date: 2011-09-25 ((2455830j,0s,0n),+0s,2299161j)>}
pry(main)> p['date'].class
=> Date
http://yaml.org/YAML_for_ruby.html#date
Tweet