lib/dry/system/config/namespace.rb in dry-system-0.22.0 vs lib/dry/system/config/namespace.rb in dry-system-0.23.0

- old
+ new

@@ -1,8 +1,9 @@ # frozen_string_literal: true require "dry/core/equalizer" +require "dry/system/constants" module Dry module System module Config # A configured namespace for a component dir @@ -52,11 +53,13 @@ end # @api private def initialize(path:, key:, const:) @path = path - @key = key + # Default keys (i.e. when the user does not explicitly provide one) for non-root + # paths will include path separators, which we must convert into key separators + @key = key && key == path ? key.gsub(PATH_SEPARATOR, KEY_SEPARATOR) : key @const = const end # @api public def root? @@ -64,14 +67,9 @@ end # @api public def path? !root? - end - - # @api private - def default_key? - key == path end end end end end