Skip to content

Instantly share code, notes, and snippets.

@apeiros
Created September 10, 2010 07:20
Show Gist options
  • Save apeiros/573239 to your computer and use it in GitHub Desktop.
Save apeiros/573239 to your computer and use it in GitHub Desktop.
unless YAML.respond_to?(:dump_file) then
def YAML.dump_file(path, content)
File.open(File.expand_path(path), 'wb') do |fh|
fh.write(content.to_yaml)
end
end
class Object
def to_y(path=nil)
path ? YAML.dump_file(path, self) : to_yaml
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment