Class: Pathname
- Inherits:
-
Object
- Object
- Pathname
- Defined in:
- lib/buildizer/core_ext/pathname.rb
Instance Method Summary collapse
Instance Method Details
#dump_yaml(cfg) ⇒ Object
9 10 11 |
# File 'lib/buildizer/core_ext/pathname.rb', line 9 def dump_yaml(cfg) write! YAML.dump(cfg) end |
#load_yaml ⇒ Object
2 3 4 5 6 7 |
# 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) ⇒ Object
13 14 15 16 |
# File 'lib/buildizer/core_ext/pathname.rb', line 13 def write!(*args, &blk) dirname.mkpath write(*args, &blk) end |