Ruby generator support for "begin" blocks

This commit is contained in:
Yorick Peterse committed 2015-08-19 20:14:21 +02:00
1 parent 92b43a7500
commit 04aa8f6546
4 files changed
+48

No files matched your search

+16
View File
@@ -52,6 +52,22 @@ module Oga
"#{var_names.join(', ')} = #{val_str}"
end
##
# Processes a `begin` node.
#
# @param [Oga::Ruby::Node] ast
# @return [String]
#
def on_begin(ast)
body = process(ast.to_a[0])
<<-EOF
begin
#{body}
end
EOF
end
##
# Processes an equality node.
#
+9
View File
@@ -104,6 +104,15 @@ module Oga
Node.new(:block, [self, args, yield])
end
##
# Wraps the current node in a `begin` node.
#
# @return [Oga::Ruby::Node]
#
def wrap
Node.new(:begin, [self])
end
##
# Wraps the current node in an if statement node.
#