Sha256: ae2710f964bd742d818ae1f371f99a8f06c7be65e57433fe7f491ae241c1b95d

Contents?: true

Size: 1006 Bytes

Versions: 38

Compression:

Stored size: 1006 Bytes

Contents

# frozen_string_literal: true

require 'eac_config/entry_path'
require 'eac_ruby_utils/core_ext'

module EacConfig
  class Entry
    enable_simple_cache
    common_constructor :root_node, :path do
      self.path = ::EacConfig::EntryPath.assert(path)
    end

    def found?
      node_entry.if_present(false, &:found?)
    end

    def found_node
      node_entry.if_present(&:node)
    end

    def value
      node_entry.if_present(&:value)
    end

    def value=(a_value)
      write_node.self_entry(path).value = a_value
    end

    def write_node
      root_node.write_node || root_node
    end

    private

    def node_entry_uncached
      node_entry_from_root || node_entry_from_load_path
    end

    def node_entry_from_load_path_uncached
      root_node.recursive_loaded_nodes.lazy.map { |loaded_node| loaded_node.self_entry(path) }
               .find(&:found?)
    end

    def node_entry_from_root_uncached
      e = root_node.self_entry(path)
      e.found? ? e : nil
    end
  end
end

Version data entries

38 entries across 38 versions & 3 rubygems

Version Path
avm-tools-0.113.5 sub/eac_config/lib/eac_config/entry.rb
eac_config-0.7.0 lib/eac_config/entry.rb
avm-tools-0.113.4 sub/eac_config/lib/eac_config/entry.rb
eac_config-0.6.0 lib/eac_config/entry.rb
avm-tools-0.113.3 sub/eac_config/lib/eac_config/entry.rb
eac_config-0.5.3 lib/eac_config/entry.rb
avm-tools-0.113.2 sub/eac_config/lib/eac_config/entry.rb
eac_config-0.5.2 lib/eac_config/entry.rb
ehbrs-tools-0.28.3 vendor/eac_config/lib/eac_config/entry.rb
avm-tools-0.110.0 vendor/eac_config/lib/eac_config/entry.rb
avm-tools-0.109.1 vendor/eac_config/lib/eac_config/entry.rb
avm-tools-0.109.0 vendor/eac_config/lib/eac_config/entry.rb
ehbrs-tools-0.28.2 vendor/eac_config/lib/eac_config/entry.rb
avm-tools-0.108.0 vendor/eac_config/lib/eac_config/entry.rb
ehbrs-tools-0.28.1 vendor/eac_config/lib/eac_config/entry.rb
avm-tools-0.107.0 vendor/eac_config/lib/eac_config/entry.rb
ehbrs-tools-0.28.0 vendor/eac_config/lib/eac_config/entry.rb
avm-tools-0.106.0 vendor/eac_config/lib/eac_config/entry.rb
ehbrs-tools-0.27.0 vendor/eac_config/lib/eac_config/entry.rb
ehbrs-tools-0.26.0 vendor/eac_config/lib/eac_config/entry.rb