Class: Avm::Entries::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/avm/entries/entry.rb,
lib/avm/entries/entry/no_context_entry.rb

Defined Under Namespace

Classes: NoContextEntry

Instance Method Summary collapse

Instance Method Details

#auto_valueObject



12
13
14
# File 'lib/avm/entries/entry.rb', line 12

def auto_value
  auto_value_entry.value
end

#auto_value_entryObject



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

Returns:

  • (Boolean)


21
22
23
# File 'lib/avm/entries/entry.rb', line 21

def context_found?
  context_entry.found?
end

#full_pathObject



25
26
27
# File 'lib/avm/entries/entry.rb', line 25

def full_path
  (parent.path_prefix + suffix_as_array).join('.')
end

#optional_valueObject



29
30
31
# File 'lib/avm/entries/entry.rb', line 29

def optional_value
  context_entry.found? ? context_entry.value : auto_value
end

#readObject



33
34
35
# File 'lib/avm/entries/entry.rb', line 33

def read
  context_entry.value
end

#suffix_as_arrayObject



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

#valueObject



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