Sha256: c70056b9a0a75bb839f235e20865aa7ed364471c2ed73166c975bc6b98129cad

Contents?: true

Size: 569 Bytes

Versions: 1

Compression:

Stored size: 569 Bytes

Contents

require 'psych'

module Canals
  module Tools
    module YAML

      def self.load(content)
        Psych.load(content, symbolize_names: true)
      end

      def self.load_file(filename)
        File.open(filename, 'r:bom|utf-8') { |f|
          Psych.load(f, filename, fallback: false, symbolize_names: true)
        }
      end

      def self.dump_file(filename, content)
        File.open(filename, 'w') do |f|
          f.write(self.to_yaml(content))
        end
      end

      def self.to_yaml(content)
        Psych.dump(content)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
canals-0.9.1 lib/canals/tools/yaml.rb