Class: SyntaxTree::Break
Overview
Break represents using the break keyword.
break
It can also optionally accept arguments, as in:
break 1
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
[Args] the arguments being sent 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: []) ⇒ Break
constructor
A new instance of Break.
Methods inherited from Node
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(arguments:, location:, comments: []) ⇒ Break
Returns a new instance of Break.
2286 2287 2288 2289 2290 |
# File 'lib/syntax_tree/node.rb', line 2286 def initialize(arguments:, location:, comments: []) @arguments = arguments @location = location @comments = comments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
[Args] the arguments being sent to the keyword
2281 2282 2283 |
# File 'lib/syntax_tree/node.rb', line 2281 def arguments @arguments end |
#comments ⇒ Object (readonly)
[Array[ Comment | EmbDoc ]] the comments attached to this node
2284 2285 2286 |
# File 'lib/syntax_tree/node.rb', line 2284 def comments @comments end |
Instance Method Details
#accept(visitor) ⇒ Object
2292 2293 2294 |
# File 'lib/syntax_tree/node.rb', line 2292 def accept(visitor) visitor.visit_break(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
2296 2297 2298 |
# File 'lib/syntax_tree/node.rb', line 2296 def child_nodes [arguments] end |
#deconstruct_keys(_keys) ⇒ Object
2302 2303 2304 |
# File 'lib/syntax_tree/node.rb', line 2302 def deconstruct_keys(_keys) { arguments: arguments, location: location, comments: comments } end |
#format(q) ⇒ Object
2306 2307 2308 |
# File 'lib/syntax_tree/node.rb', line 2306 def format(q) FlowControlFormatter.new("break", self).format(q) end |