Sha256: 2d0c46e03a544de3e1a84acc005dd166545b0fbc27a82d552b1c0e3cee1744a9

Contents?: true

Size: 1.53 KB

Versions: 14

Compression:

Stored size: 1.53 KB

Contents

# frozen_string_literal: true

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

module Avm
  module Entries
    module Base
      require_sub __FILE__, require_dependency: true
      common_concern

      module ClassMethods
        def uri_components_entries_values(prefix, extra_fields = [])
          ::Avm::Entries::Base::UriComponentsEntriesValues.new(self, prefix, extra_fields).result
        end
      end

      def entries_provider_id
        id
      end

      # @raise
      # @return [void]
      def entries_provider_id!
        return entries_provider_id unless
        entries_provider_id.include?(::EacConfig::EntryPath::PART_SEPARATOR)

        raise ".entries_provider_id \"#{entries_provider_id}\" cannot have " \
              "\"#{::EacConfig::EntryPath::PART_SEPARATOR}\" (EacConfig::EntryPath::PART_SEPARATOR)"
      end

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

      def path_prefix
        @path_prefix ||= [entries_provider_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 = ::EacConfig::PathsHash.parse_entry_key(entry_suffix.to_s)
        end
        (path_prefix + entry_suffix).join('.')
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
avm-0.94.1 lib/avm/entries/base.rb
eac_tools-0.98.0 sub/avm/lib/avm/entries/base.rb
avm-0.94.0 lib/avm/entries/base.rb
eac_tools-0.94.0 sub/avm/lib/avm/entries/base.rb
avm-0.93.0 lib/avm/entries/base.rb
eac_tools-0.92.0 sub/avm/lib/avm/entries/base.rb
avm-0.92.0 lib/avm/entries/base.rb
eac_tools-0.91.0 sub/avm/lib/avm/entries/base.rb
avm-0.90.1 lib/avm/entries/base.rb
eac_tools-0.87.1 sub/avm/lib/avm/entries/base.rb
avm-0.90.0 lib/avm/entries/base.rb
eac_tools-0.87.0 sub/avm/lib/avm/entries/base.rb
avm-0.89.0 lib/avm/entries/base.rb
eac_tools-0.86.12 sub/avm/lib/avm/entries/base.rb