Class: SyntaxTree::Return
Overview
Return represents using the return
keyword with arguments.
return value
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
- Args
-
the arguments being passed to the keyword.
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(arguments:, location:, comments: []) ⇒ Return
constructor
A new instance of Return.
Methods inherited from Node
Constructor Details
#initialize(arguments:, location:, comments: []) ⇒ Return
Returns a new instance of Return.
7661 7662 7663 7664 7665 |
# File 'lib/syntax_tree/node.rb', line 7661 def initialize(arguments:, location:, comments: []) @arguments = arguments @location = location @comments = comments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
- Args
-
the arguments being passed to the keyword
7656 7657 7658 |
# File 'lib/syntax_tree/node.rb', line 7656 def arguments @arguments end |
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
7659 7660 7661 |
# File 'lib/syntax_tree/node.rb', line 7659 def comments @comments end |
Instance Method Details
#accept(visitor) ⇒ Object
7667 7668 7669 |
# File 'lib/syntax_tree/node.rb', line 7667 def accept(visitor) visitor.visit_return(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
7671 7672 7673 |
# File 'lib/syntax_tree/node.rb', line 7671 def child_nodes [arguments] end |
#deconstruct_keys(keys) ⇒ Object
7677 7678 7679 |
# File 'lib/syntax_tree/node.rb', line 7677 def deconstruct_keys(keys) { arguments: arguments, location: location, comments: comments } end |
#format(q) ⇒ Object
7681 7682 7683 |
# File 'lib/syntax_tree/node.rb', line 7681 def format(q) FlowControlFormatter.new("return", self).format(q) end |