Sha256: 1de8f27c49de50976f283d6aafee7bb4eaaa5ebb9d35682b7da98b08cc104e8e

Contents?: true

Size: 1.61 KB

Versions: 100

Compression:

Stored size: 1.61 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'
require 'eac_ruby_utils/context'

module EacConfig
  module Node
    class << self
      def context
        @context ||= ::EacRubyUtils::Context.new
      end
    end

    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

    # @return [EacConfig::PrefixedPathNode]
    def with_prefix(path_prefix)
      require 'eac_config/prefixed_path_node'
      ::EacConfig::PrefixedPathNode.new(self, path_prefix)
    end

    private

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

Version data entries

100 entries across 100 versions & 2 rubygems

Version Path
eac_tools-0.70.1 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.70.0 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.69.1 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.69.0 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.68.0 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.67.1 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.67.0 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.66.0 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.65.1 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.65.0 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.64.0 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.63.0 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.62.1 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.62.0 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.61.1 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.61.0 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.60.3 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.60.2 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.60.1 sub/eac_config/lib/eac_config/node.rb
eac_tools-0.60.0 sub/eac_config/lib/eac_config/node.rb