Class: EacConfig::YamlFileNode
- Inherits:
-
Object
- Object
- EacConfig::YamlFileNode
show all
- Includes:
- Node
- Defined in:
- lib/eac_config/yaml_file_node.rb,
lib/eac_config/yaml_file_node/entry.rb
Defined Under Namespace
Classes: Entry
Instance Attribute Summary
Attributes included from Node
#write_node
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Node
#entry, #load_path, #recursive_loaded_nodes, #self_entry, #self_entry_class, #self_loaded_nodes
Class Method Details
.from_uri(uri) ⇒ Object
14
15
16
|
# File 'lib/eac_config/yaml_file_node.rb', line 14
def from_uri(uri)
return new(uri.to_addressable.path) if uri.to_addressable.scheme == 'file'
end
|
Instance Method Details
#data ⇒ Object
23
24
25
|
# File 'lib/eac_config/yaml_file_node.rb', line 23
def data
@data ||= ::EacRubyUtils::Yaml.load_file(assert_path) || {}
end
|
#persist_data(new_data) ⇒ Object
27
28
29
30
31
|
# File 'lib/eac_config/yaml_file_node.rb', line 27
def persist_data(new_data)
path.parent.mkpath
::EacRubyUtils::Yaml.dump_file(path, new_data)
@data = nil
end
|
#url ⇒ Object
33
34
35
|
# File 'lib/eac_config/yaml_file_node.rb', line 33
def url
::Addressable::URI.parse("file://#{path.expand_path}")
end
|