Skip to content

Instantly share code, notes, and snippets.

@thinkerbot
Created May 27, 2009 01:22
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 thinkerbot/118406 to your computer and use it in GitHub Desktop.
Save thinkerbot/118406 to your computer and use it in GitHub Desktop.
add a domain type to YAML
# Demonstrates how to add a domain type to YAML. Note
# that the namespace and year have to be as written...
# "tap.rubyforge.org,2009" doesn't work, for instance.
require 'yaml'
YAML::add_domain_type( "tap.yaml.org,2002", "object" ) do |type, val|
"loaded: #{type} (#{val})"
end
puts YAML.load("!tap/object foo")
# => loaded: tag:tap.yaml.org,2002:object (foo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment