10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/de_rjs/rewriter/erbify.rb', line 10
def rewrite_page_calls(node)
receiver_node, method_name, *arg_nodes = *node
if receiver_node.to_a.last == :page
case method_name
when :replace_html, :replace
rewrite_replace_html(receiver_node, method_name, *arg_nodes)
when :insert_html
rewrite_insert_html(receiver_node, method_name, *arg_nodes)
when :redirect_to
rewrite_redirect_to(receiver_node, method_name, *arg_nodes)
when :visual_effect
rewrite_visual_effect(receiver_node, method_name, *arg_nodes)
when :[]
rewrite_square_bracket(receiver_node, method_name, *arg_nodes)
else
rewrite_all_args(receiver_node, method_name, *arg_nodes)
end
end
if receiver_node.to_a.first.to_a.last == :page && receiver_node.to_a[1] == :[]
rewrite_square_bracket(*receiver_node.to_a)
rewrite_square_replace(receiver_node, method_name, *arg_nodes) if [:replace, :replace_html].include?(method_name)
end
end
|