Class: XCCache::YAMLRepresentable

Inherits:
HashRepresentable show all
Defined in:
lib/xccache/core/syntax/yml.rb

Direct Known Subclasses

Config

Instance Attribute Summary

Attributes inherited from HashRepresentable

#path, #raw

Instance Method Summary collapse

Methods inherited from HashRepresentable

#[], #[]=, #initialize, #merge!

Constructor Details

This class inherits a constructor from XCCache::HashRepresentable

Instance Method Details

#loadObject



6
7
8
9
10
# File 'lib/xccache/core/syntax/yml.rb', line 6

def load
  YAML.safe_load(path.read) if path.exist?
rescue StandardError
  {}
end

#save(to: nil) ⇒ Object



12
13
14
# File 'lib/xccache/core/syntax/yml.rb', line 12

def save(to: nil)
  (to || path).write(raw.to_yaml)
end