class SmartCore::Container::DependencyResolver::Route
@api private @since 0.8.0
Constants
- PATH_PART_SEPARATOR
@return [String]
@api private @since 0.8.0
Attributes
path[R]
@return [String]
@api private @since 0.8.0
path_parts[R]
@return [Array<String>]
@api private @since 0.8.0
size[R]
@return [Integer]
@api private @since 0.8.0
Public Class Methods
build(path)
click to toggle source
@param path [String, Symbol] @return [SmartCore::Container::DependencyResolver::Route]
@api private @since 0.8.0
# File lib/smart_core/container/dependency_resolver/route.rb, line 23 def build(path) new(SmartCore::Container::KeyGuard.indifferently_accessable_key(path)) end
build_path(*path_parts)
click to toggle source
@return [Array<String>]
@api private @since 0.8.0
# File lib/smart_core/container/dependency_resolver/route.rb, line 31 def build_path(*path_parts) path_parts.join(PATH_PART_SEPARATOR) end
new(path)
click to toggle source
@param path [String] @return [void]
@api private @since 0.8.0
# File lib/smart_core/container/dependency_resolver/route.rb, line 53 def initialize(path) @path = path @path_parts = path.split(PATH_PART_SEPARATOR).freeze @size = @path_parts.size end
Public Instance Methods
each(&block)
click to toggle source
@param block [Block] @yield cursor [SmartCore::Container::DependencyResolver::Route::Cursor] @return [Enumerable]
@api private @since 0.8.0
# File lib/smart_core/container/dependency_resolver/route.rb, line 65 def each(&block) enumerator = Enumerator.new do |yielder| path_parts.each_with_index do |path_part, path_part_index| cursor = Cursor.new(path_part, path_part_index, self) yielder.yield(cursor) end end block_given? ? enumerator.each(&block) : enumerator end