Class: Avm::Instances::Entry
Class Method Summary collapse
Instance Method Summary collapse
- #auto_value ⇒ Object
- #auto_value_method ⇒ Object
- #full_path ⇒ Object
- #optional_value ⇒ Object
- #read(extra_options = {}) ⇒ Object
- #suffix_as_array ⇒ Object
- #value ⇒ Object
- #write(value) ⇒ Object
Class Method Details
.auto_value_method_name(suffix) ⇒ Object
9 10 11 |
# File 'lib/avm/instances/entry.rb', line 9 def auto_value_method_name(suffix) "auto_#{suffix.to_s.gsub('.', '_')}" end |
Instance Method Details
#auto_value ⇒ Object
16 17 18 |
# File 'lib/avm/instances/entry.rb', line 16 def auto_value parent.respond_to?(auto_value_method, true) ? parent.send(auto_value_method) : nil end |
#auto_value_method ⇒ Object
20 21 22 |
# File 'lib/avm/instances/entry.rb', line 20 def auto_value_method self.class.auto_value_method_name(suffix) end |
#full_path ⇒ Object
24 25 26 |
# File 'lib/avm/instances/entry.rb', line 24 def full_path (parent.path_prefix + suffix_as_array).join('.') end |
#optional_value ⇒ Object
28 29 30 |
# File 'lib/avm/instances/entry.rb', line 28 def optional_value read(required: false, noinput: true) || auto_value end |
#read(extra_options = {}) ⇒ Object
32 33 34 |
# File 'lib/avm/instances/entry.rb', line 32 def read( = {}) ::Avm.configs.read_entry(full_path, .merge()) end |
#suffix_as_array ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/avm/instances/entry.rb', line 36 def suffix_as_array if suffix.is_a?(::Array) suffix.dup else ::EacRubyUtils::PathsHash.parse_entry_key(suffix.to_s) end end |
#value ⇒ Object
44 45 46 |
# File 'lib/avm/instances/entry.rb', line 44 def value optional_value || read end |