Class: HieraExplain::Datasource
- Inherits:
-
Object
- Object
- HieraExplain::Datasource
- Defined in:
- lib/hiera_explain/datasource.rb,
lib/hiera_explain/datasource/marshal.rb
Class Method Summary collapse
- .eyaml(path) ⇒ Object
- .json(path) ⇒ Object
-
.marshall(path) ⇒ Object
marshall is a data serialization format for Ruby.
- .yaml(path) ⇒ Object
Class Method Details
.eyaml(path) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/hiera_explain/datasource.rb', line 13 def self.eyaml(path) require 'yaml' data = YAML.load_file(path) data.each do |key, value| data[key] = '<<encrypted>>' if data =~ /.*ENC\[.*?\]/ end data end |
.json(path) ⇒ Object
8 9 10 11 |
# File 'lib/hiera_explain/datasource.rb', line 8 def self.json(path) require 'json' JSON.parse(File.read(path)) end |
.marshall(path) ⇒ Object
marshall is a data serialization format for Ruby. There does not exist a Hiera backend for using it, nor should there be as it’s a binary format. But if there were, this would make hiera_explain understand it.
6 7 8 |
# File 'lib/hiera_explain/datasource/marshal.rb', line 6 def self.marshall(path) Marshal::load(File.read(path)) end |
.yaml(path) ⇒ Object
3 4 5 6 |
# File 'lib/hiera_explain/datasource.rb', line 3 def self.yaml(path) require 'yaml' YAML.load_file(path) end |