Sha256: b723613ca60d84017d4c7f34d57ef666463b624502b46f46c376d02976144f7f
Contents?: true
Size: 832 Bytes
Versions: 1
Compression:
Stored size: 832 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/trunk/Psych.html#method-c-dump # +YAML.dump+}. # # @example # { "key" => "value" }.write_to_yaml("out.yaml") # == { "key" => "value" } # File.read("out.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-1.3.0 | lib/pleasant_path/yaml/object.rb |