Module: YAML
- Defined in:
- lib/yaml_extend.rb
Overview
Extending the YAML library to allow to inherit from another YAML file(s)
Constant Summary collapse
- DEFAULT_INHERITANCE_KEY =
default path in the yaml file where the files to inherit from are defined
'extends'
- DEEP_MERGE_OPTIONS =
[ :preserve_unmergeables, :knockout_prefix, :overwrite_arrays, :sort_merged_arrays, :unpack_arrays, :merge_hash_arrays, :extend_existing_arrays, :merge_nil_values, :merge_debug, ]
- @@ext_load_key =
nil
Class Method Summary collapse
-
.ext_load_file(yaml_path, inheritance_key = nil, options = {}) ⇒ Hash
Extended variant of the YAML.load_file method by providing the ability to inherit from other YAML file(s).
-
.ext_load_key=(key) ⇒ Object
Set a custom inheritance key globally once.
-
.reset_load_key ⇒ Object
Reset the ext_load_key and use the default settings.
Class Method Details
.ext_load_file(yaml_path, inheritance_key = nil, options = {}) ⇒ Hash
Extended variant of the YAML.load_file method by providing the ability to inherit from other YAML file(s)
deep merge options that can be passed by - but the defaults differ from original github.com/danielsdeleo/deep_merge#options
74 75 76 |
# File 'lib/yaml_extend.rb', line 74 def self.ext_load_file(yaml_path, inheritance_key = nil, = {}) YAML.ext_load_file_recursive(yaml_path, inheritance_key, , {}) end |
.ext_load_key=(key) ⇒ Object
Set a custom inheritance key globally once. So you don’t need to specify it on every call of ext_load_file()
34 35 36 37 38 39 40 |
# File 'lib/yaml_extend.rb', line 34 def self.ext_load_key=(key) if key.is_a?(String) || key.is_a?(Array) || key.nil? @@ext_load_key = key else raise "Parameter 'key' must be of type String or Array<String> or nil" end end |
.reset_load_key ⇒ Object
Reset the ext_load_key and use the default settings
45 46 47 |
# File 'lib/yaml_extend.rb', line 45 def self.reset_load_key() @@ext_load_key = nil end |