Class: Avm::Entries::Entry
- Inherits:
-
Object
- Object
- Avm::Entries::Entry
- Defined in:
- lib/avm/entries/entry.rb,
lib/avm/entries/entry/no_context_entry.rb
Defined Under Namespace
Classes: NoContextEntry
Instance Method Summary collapse
- #auto_value ⇒ Object
- #auto_value_entry ⇒ Object
- #context_found? ⇒ Boolean
- #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 |
#found? ⇒ Boolean
26 27 28 |
# File 'lib/avm/entries/entry.rb', line 26 def found? context_found? end |
#full_path ⇒ Object
30 31 32 |
# File 'lib/avm/entries/entry.rb', line 30 def full_path (parent.path_prefix + suffix_as_array).join('.') end |
#optional_value ⇒ Object
34 35 36 |
# File 'lib/avm/entries/entry.rb', line 34 def optional_value context_entry.found? ? context_entry.value : auto_value end |
#read ⇒ Object
38 39 40 |
# File 'lib/avm/entries/entry.rb', line 38 def read context_entry.value end |
#suffix_as_array ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/avm/entries/entry.rb', line 42 def suffix_as_array if suffix.is_a?(::Array) suffix.dup else ::EacConfig::PathsHash.parse_entry_key(suffix.to_s) end end |
#value ⇒ Object
50 51 52 |
# File 'lib/avm/entries/entry.rb', line 50 def value optional_value || read end |
#value! ⇒ Object
54 55 56 57 |
# File 'lib/avm/entries/entry.rb', line 54 def value! optional_value.if_present { |v| return v } context_entry.value! end |
#write(value) ⇒ Object
59 60 61 |
# File 'lib/avm/entries/entry.rb', line 59 def write(value) context_entry.value = value end |