Sha256: ef71fda6d0b8d8c931fd71fb2a45cdd30c4df07fb13ca75295565a7660d20059

Contents?: true

Size: 561 Bytes

Versions: 11

Compression:

Stored size: 561 Bytes

Contents

# frozen_string_literal: true

require 'avm/registry/base'
require 'eac_ruby_utils/core_ext'

module Avm
  module Registry
    class WithPath < ::Avm::Registry::Base
      def detect_by_path(path)
        detect_by_path_optional(path) || raise_not_found(path)
      end

      def detect_by_path_optional(path)
        current_path = path.to_pathname.expand_path
        until current_path.root?
          detect_optional(current_path).if_present { |v| return v }
          current_path = current_path.parent
        end
        nil
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
eac_tools-0.7.0 sub/avm/lib/avm/registry/with_path.rb
avm-0.25.0 lib/avm/registry/with_path.rb
eac_tools-0.6.0 sub/avm/lib/avm/registry/with_path.rb
eac_tools-0.5.0 sub/avm/lib/avm/registry/with_path.rb
avm-0.24.0 lib/avm/registry/with_path.rb
eac_tools-0.4.0 sub/avm/lib/avm/registry/with_path.rb
eac_tools-0.3.0 sub/avm/lib/avm/registry/with_path.rb
eac_tools-0.2.2 sub/avm/lib/avm/registry/with_path.rb
avm-0.23.0 lib/avm/registry/with_path.rb
avm-0.22.0 lib/avm/registry/with_path.rb
avm-tools-0.120.0 sub/avm/lib/avm/registry/with_path.rb