Class: Transpec::DynamicAnalyzer::Rewriter
Instance Method Summary
collapse
Methods included from Util
const_name, contain_here_document?, here_document?, in_parentheses?, indentation_of_line, proc_literal?
#rewrite, #rewrite_file!
Instance Method Details
#clear_requests! ⇒ Object
23
24
25
|
# File 'lib/transpec/dynamic_analyzer/rewriter.rb', line 23
def clear_requests!
@requests = nil
end
|
#process(ast, source_rewriter) ⇒ Object
12
13
14
15
16
17
|
# File 'lib/transpec/dynamic_analyzer/rewriter.rb', line 12
def process(ast, source_rewriter)
clear_requests!
collect_requests(ast)
process_requests(source_rewriter)
end
|
#register_request(node, key, instance_eval_string, eval_target_type = :object) ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'lib/transpec/dynamic_analyzer/rewriter.rb', line 27
def register_request(node, key, instance_eval_string, eval_target_type = :object)
unless EVAL_TARGET_TYPES.include?(eval_target_type)
fail "Target type must be any of #{EVAL_TARGET_TYPES}"
end
requests[node] ||= {}
requests[node][key] = [eval_target_type, instance_eval_string]
end
|
#requests ⇒ Object
19
20
21
|
# File 'lib/transpec/dynamic_analyzer/rewriter.rb', line 19
def requests
@requests ||= {}
end
|