Method: Object#write_to_yaml
- Defined in:
- lib/pleasant_path/yaml/object.rb
#write_to_yaml(file, options = {}) ⇒ self
Writes the Object serialized as YAML to the specified file,
overwriting the file if it exists. Creates the file if it does not
exist, including any necessary parent directories. Returns the
Object, unmodified.
For information about options see
+YAML.dump+.
21 22 23 24 25 26 |
# File 'lib/pleasant_path/yaml/object.rb', line 21 def write_to_yaml(file, = {}) file.to_pathname.make_dirname.open("w") do |f| YAML.dump(self, f, ) end self end |