Class: Hashira::Coupling::References
- Inherits:
-
Object
- Object
- Hashira::Coupling::References
- Defined in:
- lib/hashira/coupling/references.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(roots = nil) ⇒ References
constructor
A new instance of References.
- #sightings(tree) ⇒ Object
Constructor Details
#initialize(roots = nil) ⇒ References
Returns a new instance of References.
10 11 12 13 14 |
# File 'lib/hashira/coupling/references.rb', line 10 def initialize(roots = nil) @roots = roots @found = [] @scopes = [[]] end |
Class Method Details
.list(tree) ⇒ Object
6 |
# File 'lib/hashira/coupling/references.rb', line 6 def self.list(tree) = new.sightings(tree).map(&:first) |
.sightings(tree, roots = nil) ⇒ Object
8 |
# File 'lib/hashira/coupling/references.rb', line 8 def self.sightings(tree, roots = nil) = new(roots).sightings(tree) |
Instance Method Details
#sightings(tree) ⇒ Object
16 17 18 19 |
# File 'lib/hashira/coupling/references.rb', line 16 def sightings(tree) collect(tree) @found end |