Sha256: fae375eb4dcc4d17f6cff32753d76a2e9ea383d5dbf4d7e5c48ef1c5aca892e3

Contents?: true

Size: 1.81 KB

Versions: 43

Compression:

Stored size: 1.81 KB

Contents

# frozen_string_literal: true

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

module Avm
  module Entries
    module Base
      class UriComponentsEntriesValues
        class GenericComponent
          common_constructor :owner, :component
          delegate :entries_provider_class, :prefix, to: :owner
          delegate :auto_method_name, :get_method_name, :get_optional_method_name,
                   to: :entry_key_path

          def define_auto_method
            outer_self = self
            entries_provider_class.define_method(auto_method_name) do
              uri_component_entry_value(outer_self.entry_key_path.to_string)
            end
          end

          def define_get_method
            outer_self = self
            entries_provider_class.define_method(get_method_name) do
              read_entry(outer_self.entry_key_path.to_string)
            end
          end

          def define_get_optional_method
            outer_self = self
            entries_provider_class.define_method(get_optional_method_name) do
              read_entry_optional(outer_self.entry_key_path.to_string)
            end
          end

          def define_inherited_value_proc_method(&block)
            entries_provider_class.define_method(inherited_value_proc_name, &block)
          end

          def entry_key_path
            ::EacConfig::EntryPath.assert([prefix, component])
          end

          def id_component
            @id_component ||= owner.component_factory('id')
          end

          def inherited_value_proc_name
            entry_key_path.inherited_block_method_name
          end

          def setup
            define_auto_method
            define_get_method
            define_get_optional_method
          end
        end
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 2 rubygems

Version Path
avm-0.94.1 lib/avm/entries/base/uri_components_entries_values/generic_component.rb
eac_tools-0.98.0 sub/avm/lib/avm/entries/base/uri_components_entries_values/generic_component.rb
avm-0.94.0 lib/avm/entries/base/uri_components_entries_values/generic_component.rb
eac_tools-0.94.0 sub/avm/lib/avm/entries/base/uri_components_entries_values/generic_component.rb
avm-0.93.0 lib/avm/entries/base/uri_components_entries_values/generic_component.rb
eac_tools-0.92.0 sub/avm/lib/avm/entries/base/uri_components_entries_values/generic_component.rb
avm-0.92.0 lib/avm/entries/base/uri_components_entries_values/generic_component.rb
eac_tools-0.91.0 sub/avm/lib/avm/entries/base/uri_components_entries_values/generic_component.rb
avm-0.90.1 lib/avm/entries/base/uri_components_entries_values/generic_component.rb
eac_tools-0.87.1 sub/avm/lib/avm/entries/base/uri_components_entries_values/generic_component.rb
avm-0.90.0 lib/avm/entries/base/uri_components_entries_values/generic_component.rb
eac_tools-0.87.0 sub/avm/lib/avm/entries/base/uri_components_entries_values/generic_component.rb
avm-0.89.0 lib/avm/entries/base/uri_components_entries_values/generic_component.rb
eac_tools-0.86.12 sub/avm/lib/avm/entries/base/uri_components_entries_values/generic_component.rb
avm-0.88.0 lib/avm/entries/base/uri_components_entries_values/generic_component.rb
eac_tools-0.86.11 sub/avm/lib/avm/entries/base/uri_components_entries_values/generic_component.rb
avm-0.87.0 lib/avm/entries/base/uri_components_entries_values/generic_component.rb
eac_tools-0.86.8 sub/avm/lib/avm/entries/base/uri_components_entries_values/generic_component.rb
avm-0.86.2 lib/avm/entries/base/uri_components_entries_values/generic_component.rb
eac_tools-0.86.7 sub/avm/lib/avm/entries/base/uri_components_entries_values/generic_component.rb