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
Constructor Details
#initialize(arguments:, location:, comments: []) ⇒ Break
Returns a new instance of Break.
2242 2243 2244 2245 2246 |
# File 'lib/syntax_tree/node.rb', line 2242 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
2237 2238 2239 |
# File 'lib/syntax_tree/node.rb', line 2237 def arguments @arguments end |
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
2240 2241 2242 |
# File 'lib/syntax_tree/node.rb', line 2240 def comments @comments end |
Instance Method Details
#accept(visitor) ⇒ Object
2248 2249 2250 |
# File 'lib/syntax_tree/node.rb', line 2248 def accept(visitor) visitor.visit_break(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
2252 2253 2254 |
# File 'lib/syntax_tree/node.rb', line 2252 def child_nodes [arguments] end |
#deconstruct_keys(keys) ⇒ Object
2258 2259 2260 |
# File 'lib/syntax_tree/node.rb', line 2258 def deconstruct_keys(keys) { arguments: arguments, location: location, comments: comments } end |
#format(q) ⇒ Object
2262 2263 2264 |
# File 'lib/syntax_tree/node.rb', line 2262 def format(q) FlowControlFormatter.new("break", self).format(q) end |