Sha256: 03de6bbd59fac46f26003e761e2d052a95df9e38b6d76fbda92500baa628dd7b
Contents?: true
Size: 837 Bytes
Versions: 1
Compression:
Stored size: 837 Bytes
Contents
# frozen_string_literal: true class Object # 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 # {https://docs.ruby-lang.org/en/master/Psych.html#method-c-dump # +YAML.dump+}. # # @example # { "key" => "value" }.write_to_yaml("file.yaml") # == { "key" => "value" } # File.read("file.yaml") # == "---\nkey: value\n" # # @param file [String, Pathname] # @param options [Hash{Symbol => Object}] # @return [self] def write_to_yaml(file, options = {}) file.to_pathname.make_dirname.open("w") do |f| YAML.dump(self, f, options) end self end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pleasant_path-2.0.0 | lib/pleasant_path/yaml/object.rb |