Class: Hashira::Coupling::Scope
- Inherits:
-
Object
- Object
- Hashira::Coupling::Scope
- Defined in:
- lib/hashira/coupling/scope.rb
Constant Summary collapse
- CORE =
Object.constants.select { Object.const_source_location(it) == [] }.to_set(&:to_s).freeze
Instance Method Summary collapse
-
#initialize(registry, catalog, placement) ⇒ Scope
constructor
A new instance of Scope.
- #pinpoint(segments) ⇒ Object
- #resolve(segments, nesting) ⇒ Object
Constructor Details
#initialize(registry, catalog, placement) ⇒ Scope
Returns a new instance of Scope.
6 7 8 9 10 |
# File 'lib/hashira/coupling/scope.rb', line 6 def initialize(registry, catalog, placement) @registry = registry @catalog = catalog @placement = placement end |
Instance Method Details
#pinpoint(segments) ⇒ Object
18 19 20 21 |
# File 'lib/hashira/coupling/scope.rb', line 18 def pinpoint(segments) return if @placement.skip?(segments) qualify(descend([], segments)) end |
#resolve(segments, nesting) ⇒ Object
12 13 14 15 16 |
# File 'lib/hashira/coupling/scope.rb', line 12 def resolve(segments, nesting) return if @placement.skip?(segments) scoped = nesting.reverse_each.filter_map { descend(it, segments) }.first scoped ? qualify(scoped) : outward(@catalog.strip(segments)) end |