Class: Transpec::DynamicAnalyzer::Rewriter
Constant Summary
collapse
- EVAL_TARGET_TYPES =
[:object, :context]
Constants included
from Util
Util::LITERAL_TYPES, Util::WHITESPACES
Instance Method Summary
collapse
Methods included from Util
const_name, contain_here_document?, expand_range_to_adjacent_whitespaces, find_consecutive_whitespace_position, here_document?, in_explicit_parentheses?, indentation_of_line, literal?, proc_literal?, taking_block?
#rewrite, #rewrite_file!
Instance Method Details
#clear_requests! ⇒ Object
28
29
30
|
# File 'lib/transpec/dynamic_analyzer/rewriter.rb', line 28
def clear_requests!
@requests = nil
end
|
#process(ast, source_rewriter) ⇒ Object
17
18
19
20
21
22
|
# File 'lib/transpec/dynamic_analyzer/rewriter.rb', line 17
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
32
33
34
35
36
37
38
39
|
# File 'lib/transpec/dynamic_analyzer/rewriter.rb', line 32
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
24
25
26
|
# File 'lib/transpec/dynamic_analyzer/rewriter.rb', line 24
def requests
@requests ||= {}
end
|