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
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(arguments:, location:, comments: []) ⇒ Return
Returns a new instance of Return.
7883 7884 7885 7886 7887 |
# File 'lib/syntax_tree/node.rb', line 7883 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
7878 7879 7880 |
# File 'lib/syntax_tree/node.rb', line 7878 def arguments @arguments end |
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
7881 7882 7883 |
# File 'lib/syntax_tree/node.rb', line 7881 def comments @comments end |
Instance Method Details
#accept(visitor) ⇒ Object
7889 7890 7891 |
# File 'lib/syntax_tree/node.rb', line 7889 def accept(visitor) visitor.visit_return(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
7893 7894 7895 |
# File 'lib/syntax_tree/node.rb', line 7893 def child_nodes [arguments] end |
#deconstruct_keys(_keys) ⇒ Object
7899 7900 7901 |
# File 'lib/syntax_tree/node.rb', line 7899 def deconstruct_keys(_keys) { arguments: arguments, location: location, comments: comments } end |
#format(q) ⇒ Object
7903 7904 7905 |
# File 'lib/syntax_tree/node.rb', line 7903 def format(q) FlowControlFormatter.new("return", self).format(q) end |