Class: Avm::Entries::Entry
- Inherits:
-
Object
- Object
- Avm::Entries::Entry
- Defined in:
- lib/avm/entries/entry.rb
Instance Method Summary collapse
- #auto_value ⇒ Object
- #auto_value_entry ⇒ Object
- #context_found? ⇒ Boolean
- #full_path ⇒ Object
- #optional_value ⇒ Object
- #read ⇒ Object
- #suffix_as_array ⇒ Object
- #value ⇒ Object
- #value! ⇒ Object
- #write(value) ⇒ Object
Instance Method Details
#auto_value ⇒ Object
12 13 14 |
# File 'lib/avm/entries/entry.rb', line 12 def auto_value auto_value_entry.value end |
#auto_value_entry ⇒ Object
16 17 18 |
# File 'lib/avm/entries/entry.rb', line 16 def auto_value_entry @auto_value_entry ||= ::Avm::Entries::AutoValues::Entry.new(parent, suffix) end |
#context_found? ⇒ Boolean
21 22 23 |
# File 'lib/avm/entries/entry.rb', line 21 def context_found? context_entry.found? end |
#full_path ⇒ Object
25 26 27 |
# File 'lib/avm/entries/entry.rb', line 25 def full_path (parent.path_prefix + suffix_as_array).join('.') end |
#optional_value ⇒ Object
29 30 31 |
# File 'lib/avm/entries/entry.rb', line 29 def optional_value context_entry.found? ? context_entry.value : auto_value end |
#read ⇒ Object
33 34 35 |
# File 'lib/avm/entries/entry.rb', line 33 def read context_entry.value end |
#suffix_as_array ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/avm/entries/entry.rb', line 37 def suffix_as_array if suffix.is_a?(::Array) suffix.dup else ::EacConfig::PathsHash.parse_entry_key(suffix.to_s) end end |
#value ⇒ Object
45 46 47 |
# File 'lib/avm/entries/entry.rb', line 45 def value optional_value || read end |
#value! ⇒ Object
49 50 51 52 |
# File 'lib/avm/entries/entry.rb', line 49 def value! optional_value.if_present { |v| return v } context_entry.value! end |
#write(value) ⇒ Object
54 55 56 |
# File 'lib/avm/entries/entry.rb', line 54 def write(value) context_entry.value = value end |