Class: SmartCore::Container::DependencyResolver::Route Private
- Inherits:
-
Object
- Object
- SmartCore::Container::DependencyResolver::Route
- Includes:
- Enumerable
- Defined in:
- lib/smart_core/container/dependency_resolver/route.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: Cursor
Instance Attribute Summary collapse
- #path ⇒ String readonly private
- #size ⇒ Integer readonly private
Class Method Summary collapse
- .build(path) ⇒ SmartCore::Container::DependencyResolver::Route private
- .build_path(*path_parts) ⇒ Array<String> private
Instance Method Summary collapse
- #each(&block) ⇒ Enumerable private
- #initialize(path) ⇒ void constructor private
Constructor Details
#initialize(path) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
50 51 52 53 54 |
# File 'lib/smart_core/container/dependency_resolver/route.rb', line 50 def initialize(path) @path = path @path_parts = path.split(SmartCore::Container::DependencyResolver::PATH_PART_SEPARATOR).freeze @size = @path_parts.size end |
Instance Attribute Details
#path ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 |
# File 'lib/smart_core/container/dependency_resolver/route.rb', line 42 def path @path end |
#size ⇒ Integer (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
36 37 38 |
# File 'lib/smart_core/container/dependency_resolver/route.rb', line 36 def size @size end |
Class Method Details
.build(path) ⇒ SmartCore::Container::DependencyResolver::Route
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 |
# File 'lib/smart_core/container/dependency_resolver/route.rb', line 18 def build(path) new(SmartCore::Container::KeyGuard.indifferently_accessable_key(path)) end |
.build_path(*path_parts) ⇒ Array<String>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/smart_core/container/dependency_resolver/route.rb', line 27 def build_path(*path_parts) path_parts.join(SmartCore::Container::DependencyResolver::PATH_PART_SEPARATOR) end |
Instance Method Details
#each(&block) ⇒ Enumerable
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/smart_core/container/dependency_resolver/route.rb', line 62 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 |