class SyntaxTree::ReturnNode
Return represents using the return
keyword with arguments.
return value
Attributes
arguments[R]
- nil |
Args
-
the arguments being passed to the keyword
Public Class Methods
new(arguments:, location:)
click to toggle source
# File lib/syntax_tree/node.rb, line 9710 def initialize(arguments:, location:) @arguments = arguments @location = location @comments = [] end
Public Instance Methods
===(other)
click to toggle source
# File lib/syntax_tree/node.rb, line 9745 def ===(other) other.is_a?(ReturnNode) && arguments === other.arguments end
accept(visitor)
click to toggle source
# File lib/syntax_tree/node.rb, line 9716 def accept(visitor) visitor.visit_return(self) end
child_nodes()
click to toggle source
# File lib/syntax_tree/node.rb, line 9720 def child_nodes [arguments] end
Also aliased as: deconstruct
copy(arguments: nil, location: nil)
click to toggle source
# File lib/syntax_tree/node.rb, line 9724 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
deconstruct_keys(_keys)
click to toggle source
# File lib/syntax_tree/node.rb, line 9737 def deconstruct_keys(_keys) { arguments: arguments, location: location, comments: comments } end
format(q)
click to toggle source
# File lib/syntax_tree/node.rb, line 9741 def format(q) FlowControlFormatter.new("return", self).format(q) end