Module: Avm::Entries::Base

Included in:
Applications::Base, Instances::Base
Defined in:
lib/avm/entries/base.rb

Instance Method Summary collapse

Instance Method Details

#entries_provider_idObject



9
10
11
# File 'lib/avm/entries/base.rb', line 9

def entries_provider_id
  id
end

#entry(suffix, options = {}) ⇒ Object



13
14
15
# File 'lib/avm/entries/base.rb', line 13

def entry(suffix, options = {})
  ::Avm::Entries::Entry.new(self, suffix, options)
end

#full_entry_path(entry_suffix) ⇒ Object



29
30
31
32
33
34
# File 'lib/avm/entries/base.rb', line 29

def full_entry_path(entry_suffix)
  unless entry_suffix.is_a?(::Array)
    entry_suffix = ::EacConfig::PathsHash.parse_entry_key(entry_suffix.to_s)
  end
  (path_prefix + entry_suffix).join('.')
end

#inherited_entry_value(source_entry_suffix, target_entry_suffix, &block) ⇒ Object



36
37
38
39
40
# File 'lib/avm/entries/base.rb', line 36

def inherited_entry_value(source_entry_suffix, target_entry_suffix, &block)
  read_entry_optional(source_entry_suffix).if_present do |instance_id|
    other_entry_value(instance_id, target_entry_suffix).if_present(&block)
  end
end

#other_entry_value(instance_id, entry_suffix) ⇒ Object



42
43
44
# File 'lib/avm/entries/base.rb', line 42

def other_entry_value(instance_id, entry_suffix)
  ::Avm::Instances::Base.by_id(instance_id).read_entry_optional(entry_suffix)
end

#path_prefixObject



17
18
19
# File 'lib/avm/entries/base.rb', line 17

def path_prefix
  @path_prefix ||= [entries_provider_id].freeze
end

#read_entry(entry_suffix, options = {}) ⇒ Object



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

def read_entry(entry_suffix, options = {})
  entry(entry_suffix, options).value
end

#read_entry_optional(entry_suffix, options = {}) ⇒ Object



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

def read_entry_optional(entry_suffix, options = {})
  entry(entry_suffix, options).optional_value
end