Sha256: aec9e43b53ec6796f8b70aba2823094263344dd83487506fcd90ec4174567345

Contents?: true

Size: 1.29 KB

Versions: 6

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

require 'eac_config/entry'
require 'eac_config/entry_path'
require 'eac_config/load_path'
require 'eac_config/load_nodes_search'
require 'eac_config/node_entry'
require 'eac_config/node_uri'
require 'eac_ruby_utils/core_ext'

module EacConfig
  module Node
    attr_accessor :write_node

    common_concern do
      enable_abstract_methods
      include ::Comparable
    end

    def entry(path)
      ::EacConfig::Entry.new(self, path)
    end

    # @return [[EacConfig::IncludePath]]
    def load_path
      @load_path ||= ::EacConfig::LoadPath.new(self)
    end

    # @return [Addressable::URI]
    def url
      raise_abstract_method(__method__)
    end

    # Return a entry which search values only in the self node.
    # @return [EacConfig::NodeEntry]
    def self_entry(path)
      self_entry_class.new(self, path)
    end

    def self_entry_class
      self.class.const_get('Entry')
    end

    # @return [Array<EacConfig::Node>]
    def self_loaded_nodes
      load_path.paths.map { |node_path| load_node(node_path) }
    end

    # @return [Array<EacConfig::Node>]
    def recursive_loaded_nodes
      ::EacConfig::LoadNodesSearch.new(self).result
    end

    private

    def load_node(node_path)
      ::EacConfig::NodeUri.new(node_path, url).instanciate
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
avm-tools-0.102.2 vendor/eac_config/lib/eac_config/node.rb
avm-tools-0.102.1 vendor/eac_config/lib/eac_config/node.rb
avm-tools-0.102.0 vendor/eac_config/lib/eac_config/node.rb
avm-tools-0.101.0 vendor/eac_config/lib/eac_config/node.rb
eac_config-0.4.0 lib/eac_config/node.rb
avm-tools-0.100.0 vendor/eac_config/lib/eac_config/node.rb