Skip to content

Instantly share code, notes, and snippets.

@marsbomber
Created January 29, 2012 06:25
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 marsbomber/1697539 to your computer and use it in GitHub Desktop.
Save marsbomber/1697539 to your computer and use it in GitHub Desktop.
Ruby 1.9.3 YAML parse
require 'yaml'
yaml = <<yaml
defaults: &defaults
cool:
bang: wow
fruit: apple
development:
<<: *defaults
cool:
fruit: banana
yaml
parsed = begin
YAML.load(yaml)
rescue ArgumentError => e
puts "Could not parse YAML: #{e.message}"
end
puts "Using: #{YAML::ENGINE.yamler}"
puts parsed.inspect
YAML::ENGINE.yamler= 'syck'
parsed = begin
YAML.load(yaml)
rescue ArgumentError => e
puts "Could not parse YAML: #{e.message}"
end
puts "Using: #{YAML::ENGINE.yamler}"
puts parsed.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment