Class: Rewrite::RewriteVariablesAsThunkCalls

Inherits:
Object
  • Object
show all
Defined in:
lib/rewrite/variables.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*list_of_variables) ⇒ RewriteVariablesAsThunkCalls

Returns a new instance of RewriteVariablesAsThunkCalls.



79
80
81
# File 'lib/rewrite/variables.rb', line 79

def initialize(*list_of_variables)
  @list_of_variables = list_of_variables
end

Instance Attribute Details

#list_of_variablesObject (readonly)

Returns the value of attribute list_of_variables.



77
78
79
# File 'lib/rewrite/variables.rb', line 77

def list_of_variables
  @list_of_variables
end

Instance Method Details

#process(sexp) ⇒ Object



83
84
85
86
87
# File 'lib/rewrite/variables.rb', line 83

def process(sexp)
  list_of_variables().inject(sexp) { |result, variable| 
    VariableRewriter.new(variable, s(:call, s(:dvar, variable), :call)).process(result)
  }
end