class Pathname

Public Instance Methods

dump_yaml(cfg) click to toggle source
# File lib/buildizer/core_ext/pathname.rb, line 9
def dump_yaml(cfg)
  write! YAML.dump(cfg)
end
load_yaml() click to toggle source
# File lib/buildizer/core_ext/pathname.rb, line 2
def load_yaml
  exist? ? YAML.load(read) || {} : {}
rescue Psych::Exception => err
  raise Buildizer::Error, error: :input_error,
                          message: "bad yaml config file #{self}: #{err.message}"
end
write!(*args, &blk) click to toggle source
# File lib/buildizer/core_ext/pathname.rb, line 13
def write!(*args, &blk)
  dirname.mkpath
  write(*args, &blk)
end