Class: ScoutApm::AutoInstrument::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/auto_instrument/parser.rb

Instance Method Summary collapse

Constructor Details

#initializeCache

Returns a new instance of Cache.



8
9
10
# File 'lib/scout_apm/auto_instrument/parser.rb', line 8

def initialize
  @local_assignments = {}
end

Instance Method Details

#local_assignments?(node) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/scout_apm/auto_instrument/parser.rb', line 12

def local_assignments?(node)
  unless @local_assignments.key?(node)
    if node.type == :lvasgn
      @local_assignments[node] = true
    elsif node.children.find{|child| child.is_a?(Parser::AST::Node) && self.local_assignments?(child)}
      @local_assignments[node] = true
    else
      @local_assignments[node] = false
    end
  end
  
  return @local_assignments[node]
end