class SyntaxTree::ReturnNode
Return represents using the return
keyword with arguments.
return value
Attributes
- nil |
Args
-
the arguments being passed to the keyword
Public Class Methods
Source
# File lib/syntax_tree/node.rb, line 9725 def initialize(arguments:, location:) @arguments = arguments @location = location @comments = [] end
Public Instance Methods
Source
# File lib/syntax_tree/node.rb, line 9760 def ===(other) other.is_a?(ReturnNode) && arguments === other.arguments end
Source
# File lib/syntax_tree/node.rb, line 9731 def accept(visitor) visitor.visit_return(self) end
Source
# File lib/syntax_tree/node.rb, line 9735 def child_nodes [arguments] end
Also aliased as: deconstruct
Source
# File lib/syntax_tree/node.rb, line 9739 def copy(arguments: nil, location: nil) node = ReturnNode.new( arguments: arguments || self.arguments, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
Source
# File lib/syntax_tree/node.rb, line 9752 def deconstruct_keys(_keys) { arguments: arguments, location: location, comments: comments } end
Source
# File lib/syntax_tree/node.rb, line 9756 def format(q) FlowControlFormatter.new("return", self).format(q) end