Module: YAML

Defined in:
lib/moon/packages/std/core_ext/yaml.rb

Class Method Summary collapse

Class Method Details

.load_file(filename) ⇒ Object

Loads a file filename and parses it as YAML

Parameters:

Returns:


6
7
8
# File 'lib/moon/packages/std/core_ext/yaml.rb', line 6

def self.load_file(filename)
  load File.read(filename)
end

.save_file(filename, obj) ⇒ Object

Saves a file after dumping it as YAML.

Parameters:

  • filename (String)

    file to write to.

  • obj (Object)

    to dump


14
15
16
# File 'lib/moon/packages/std/core_ext/yaml.rb', line 14

def self.save_file(filename, obj)
  File.open(filename, "w") { |f| f.write dump(obj) }
end