Ruby generator support for "begin" blocks
This commit is contained in:
1 parent
92b43a7500
commit
04aa8f6546
4 files changed
+48
No files matched your search
@@ -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.
|
||||
#
|
||||
|
||||
@@ -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.
|
||||
#
|
||||
|
||||
Reference in new issue
Block a user