Sha256: a6e87c17f26cdd2ef379ddb058985e19f787118134a1b96f4c51b915c6bfc2d2

Contents?: true

Size: 1.29 KB

Versions: 41

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

require 'avm/entries/uri_builder'
require 'eac_config/entry_path'
require 'eac_ruby_utils/core_ext'

module Avm
  module Entries
    module Base
      class InheritedEntryValue
        enable_method_class
        common_constructor :entries_provider, :source_entry_suffix, :target_entry_suffix, :block,
                           block_arg: true

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

        # @param provider_id [String]
        # @return [Avm::Entries::Base]
        def other_entries_provider(provider_id)
          other_entries_provider_class.by_id(provider_id)
        end

        # @return [Class]
        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

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

        def self_entry_value
          entries_provider.read_entry_optional(source_entry_suffix)
        end
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
avm-0.94.0 lib/avm/entries/base/inherited_entry_value.rb
eac_tools-0.94.0 sub/avm/lib/avm/entries/base/inherited_entry_value.rb
avm-0.93.0 lib/avm/entries/base/inherited_entry_value.rb
eac_tools-0.92.0 sub/avm/lib/avm/entries/base/inherited_entry_value.rb
avm-0.92.0 lib/avm/entries/base/inherited_entry_value.rb
eac_tools-0.91.0 sub/avm/lib/avm/entries/base/inherited_entry_value.rb
avm-0.90.1 lib/avm/entries/base/inherited_entry_value.rb
eac_tools-0.87.1 sub/avm/lib/avm/entries/base/inherited_entry_value.rb
avm-0.90.0 lib/avm/entries/base/inherited_entry_value.rb
eac_tools-0.87.0 sub/avm/lib/avm/entries/base/inherited_entry_value.rb
avm-0.89.0 lib/avm/entries/base/inherited_entry_value.rb
eac_tools-0.86.12 sub/avm/lib/avm/entries/base/inherited_entry_value.rb
avm-0.88.0 lib/avm/entries/base/inherited_entry_value.rb
eac_tools-0.86.11 sub/avm/lib/avm/entries/base/inherited_entry_value.rb
avm-0.87.0 lib/avm/entries/base/inherited_entry_value.rb
eac_tools-0.86.8 sub/avm/lib/avm/entries/base/inherited_entry_value.rb
avm-0.86.2 lib/avm/entries/base/inherited_entry_value.rb
eac_tools-0.86.7 sub/avm/lib/avm/entries/base/inherited_entry_value.rb
avm-0.86.1 lib/avm/entries/base/inherited_entry_value.rb
eac_tools-0.86.5 sub/avm/lib/avm/entries/base/inherited_entry_value.rb