Sha256: 5baefd38c11dc438f546ff971f4360458331ffc5530b2b7159382b102879d54e

Contents?: true

Size: 1.04 KB

Versions: 11

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require 'eac_cli/speaker'
require 'eac_config/entry_path'
require 'eac_ruby_utils/core_ext'

module EacCli
  class Config
    class Entry
      require_sub __FILE__, include_modules: true
      enable_listable
      enable_simple_cache
      enable_speaker

      common_constructor :config, :path, :options do
        self.path = ::EacConfig::EntryPath.assert(path)
        self.options = ::EacCli::Config::Entry::Options.new(options)
      end

      def value
        return sub_value_to_return if sub_entry.found?
        return nil unless options.required?

        puts "|#{sub_entry.path}|"

        input_value
      end

      delegate :value=, to: :sub_entry

      private

      def sub_value_to_return
        sub_entry.value.presence || ::EacRubyUtils::BlankNotBlank.instance
      end

      def sub_entry_uncached
        config.sub.entry(path)
      end

      def input_value_uncached
        r = send("#{options.type}_value")
        sub_entry.value = r if options.store?
        r
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
eac_cli-0.21.1 lib/eac_cli/config/entry.rb
ehbrs-tools-0.22.0 vendor/eac_cli/lib/eac_cli/config/entry.rb
eac_cli-0.21.0 lib/eac_cli/config/entry.rb
eac_cli-0.20.4 lib/eac_cli/config/entry.rb
eac_cli-0.20.3 lib/eac_cli/config/entry.rb
avm-tools-0.102.2 vendor/eac_cli/lib/eac_cli/config/entry.rb
eac_cli-0.20.2 lib/eac_cli/config/entry.rb
avm-tools-0.102.1 vendor/eac_cli/lib/eac_cli/config/entry.rb
eac_cli-0.20.1 lib/eac_cli/config/entry.rb
eac_cli-0.20.0 lib/eac_cli/config/entry.rb
avm-tools-0.102.0 vendor/eac_cli/lib/eac_cli/config/entry.rb