Class: Ionize::Php::Translate::Rewrites
Constant Summary
Constants inherited
from Translator
Translator::SimpleTransforms
Instance Attribute Summary
Attributes inherited from Translator
#parent
Instance Method Summary
collapse
Methods included from Debug
#debug, #logger
Methods included from Rewritable
#fcall_rewritable?, #handle_regular_fun_call, #handle_term_assign, #handle_term_assign_array_append, #handle_term_assign_array_lookup, #handle_term_assign_oo_array_lookup, #handle_term_assign_oo_variable, #handle_term_assign_oo_variable_variable, #lasgn_rewritable?, #rewrite_fcall, #rewrite_lasgn, #transform
#rewrite_fcall_array_combine, #rewrite_fcall_array_merge, #rewrite_fcall_count, #rewrite_fcall_explode, #rewrite_fcall_file, #rewrite_fcall_implode, #rewrite_fcall_in_array, #rewrite_fcall_ltrim, #rewrite_fcall_md5, #rewrite_fcall_md5_file, #rewrite_fcall_preg_replace, #rewrite_fcall_preg_split, #rewrite_fcall_rtrim, #rewrite_fcall_sha1, #rewrite_fcall_sha1_file, #rewrite_fcall_str_ireplace, #rewrite_fcall_str_replace, #rewrite_fcall_stripslashes, #rewrite_fcall_strlen, #rewrite_fcall_strpos, #rewrite_fcall_strrev, #rewrite_fcall_strrpos, #rewrite_fcall_strtolower, #rewrite_fcall_strtoupper, #rewrite_fcall_strtr, #rewrite_fcall_substr, #rewrite_fcall_substr_replace, #rewrite_fcall_trim, #rewrite_fcall_ucfirst, #rewrite_lasgn_preg_match, #rewrite_lasgn_preg_match_all
Methods inherited from Translator
handle_node, #handle_num, #initialize, #send, #transform
Instance Method Details
#rewrite_fcall_array_intersect(args) ⇒ Object
41
42
43
|
# File 'lib/ionize/translate/rewrites.rb', line 41
def rewrite_fcall_array_intersect(args)
[:call, args.second, :intersect, [:array, args.third]]
end
|
#rewrite_fcall_define(args) ⇒ Object
29
30
31
|
# File 'lib/ionize/translate/rewrites.rb', line 29
def rewrite_fcall_define(args)
[:cdecl, args.second.second.to_sym, args.third]
end
|
#rewrite_fcall_function_exists(args) ⇒ Object
33
34
35
|
# File 'lib/ionize/translate/rewrites.rb', line 33
def rewrite_fcall_function_exists(args)
[:fcall, :respond_to?, args]
end
|
#rewrite_fcall_isset(args) ⇒ Object
37
38
39
|
# File 'lib/ionize/translate/rewrites.rb', line 37
def rewrite_fcall_isset(args)
[:call, args.second, :not_nil?]
end
|
#rewrite_fcall_mysql_connect(args) ⇒ Object
45
46
47
|
# File 'lib/ionize/translate/rewrites.rb', line 45
def rewrite_fcall_mysql_connect(args)
[:call, [:const, :Mysql], :new, args]
end
|
#rewrite_fcall_var_dump(args) ⇒ Object
25
26
27
|
# File 'lib/ionize/translate/rewrites.rb', line 25
def rewrite_fcall_var_dump(args)
[:fcall, :puts, args]
end
|
#rewrite_lasgn_ereg(var, expr) ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/ionize/translate/rewrites.rb', line 9
def rewrite_lasgn_ereg(var, expr)
regex, object, matches = *expr.last.rest
[:masgn,
[:array, [:lasgn, var], [:lasgn, matches.last]],
[:to_ary, [:call, object, :match, [:array, [:lit, eval("/" + regex.last + "/")]]]]]
end
|
#rewrite_lasgn_eregi(var, expr) ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/ionize/translate/rewrites.rb', line 17
def rewrite_lasgn_eregi(var, expr)
regex, object, matches = *expr.last.rest
[:masgn,
[:array, [:lasgn, var], [:lasgn, matches.last]],
[:to_ary, [:call, object, :match, [:array, [:lit, eval("/" + regex.last + "/i")]]]]]
end
|