Class: Synvert::Rewriter::Scopes
- Inherits:
-
Object
- Object
- Synvert::Rewriter::Scopes
- Defined in:
- lib/synvert/rewriter/scopes.rb
Instance Method Summary collapse
- #add(options) ⇒ Object
-
#initialize ⇒ Scopes
constructor
A new instance of Scopes.
- #matching_nodes(node) ⇒ Object
Constructor Details
#initialize ⇒ Scopes
Returns a new instance of Scopes.
5 6 7 |
# File 'lib/synvert/rewriter/scopes.rb', line 5 def initialize @scopes = [] end |
Instance Method Details
#add(options) ⇒ Object
9 10 11 |
# File 'lib/synvert/rewriter/scopes.rb', line 9 def add() @scopes << Rewriter::Scope.new() end |
#matching_nodes(node) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/synvert/rewriter/scopes.rb', line 13 def matching_nodes(node) nodes = [node] @scopes.each do |scope| break if nodes.empty? nodes = scope.matching_nodes(nodes) end nodes end |