Sha256: ff7a0bea40932473683375829af69c11230ac147442d8e792866e4ef7733b0be

Contents?: true

Size: 1.21 KB

Versions: 40

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'
require 'avm/configs'
require 'avm/instances/entry'

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

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

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

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

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

      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

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

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
avm-tools-0.98.0 lib/avm/instances/entries.rb
avm-tools-0.97.0 lib/avm/instances/entries.rb
avm-tools-0.96.0 lib/avm/instances/entries.rb
avm-tools-0.95.0 lib/avm/instances/entries.rb
avm-tools-0.94.3 lib/avm/instances/entries.rb
avm-tools-0.94.2 lib/avm/instances/entries.rb
avm-tools-0.94.1 lib/avm/instances/entries.rb
avm-tools-0.94.0 lib/avm/instances/entries.rb
avm-tools-0.93.0 lib/avm/instances/entries.rb
avm-tools-0.92.0 lib/avm/instances/entries.rb
avm-tools-0.91.0 lib/avm/instances/entries.rb
avm-tools-0.90.0 lib/avm/instances/entries.rb
avm-tools-0.89.0 lib/avm/instances/entries.rb
avm-tools-0.88.0 lib/avm/instances/entries.rb
avm-tools-0.87.1 lib/avm/instances/entries.rb
avm-tools-0.87.0 lib/avm/instances/entries.rb
avm-tools-0.86.0 lib/avm/instances/entries.rb
avm-tools-0.85.1 lib/avm/instances/entries.rb
avm-tools-0.85.0 lib/avm/instances/entries.rb
avm-tools-0.84.0 lib/avm/instances/entries.rb