Class: Avm::Entries::Base::InheritedEntryValue

Inherits:
Object
  • Object
show all
Defined in:
lib/avm/entries/base/inherited_entry_value.rb

Instance Method Summary collapse

Instance Method Details

#other_entries_provider(provider_id) ⇒ Avm::Entries::Base

Parameters:

  • provider_id (String)

Returns:



23
24
25
# File 'lib/avm/entries/base/inherited_entry_value.rb', line 23

def other_entries_provider(provider_id)
  other_entries_provider_class.by_id(provider_id)
end

#other_entries_provider_classClass

Returns:

  • (Class)


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

def other_entries_provider_class
  [::Avm::Instances::Base, ::Avm::Applications::Base].each do |klass|
    return klass if entries_provider.is_a?(klass)
  end

  raise "No provider class found for \"#{entries_provider}\""
end

#other_entry_value(instance_id) ⇒ Object



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

def other_entry_value(instance_id)
  other_entries_provider(instance_id).read_entry_optional(target_entry_suffix)
end

#resultObject



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

def result
  self_entry_value.if_present do |instance_id|
    other_entry_value(instance_id).if_present(&block)
  end
end

#self_entry_valueObject



40
41
42
# File 'lib/avm/entries/base/inherited_entry_value.rb', line 40

def self_entry_value
  entries_provider.read_entry_optional(source_entry_suffix)
end