class SyntaxTree::Break
Break
represents using the break
keyword.
break
It can also optionally accept arguments, as in:
break 1
Attributes
Args
-
the arguments being sent to the keyword
Public Class Methods
Source
# File lib/syntax_tree/node.rb, line 2656 def initialize(arguments:, location:) @arguments = arguments @location = location @comments = [] end
Public Instance Methods
Source
# File lib/syntax_tree/node.rb, line 2691 def ===(other) other.is_a?(Break) && arguments === other.arguments end
Source
# File lib/syntax_tree/node.rb, line 2662 def accept(visitor) visitor.visit_break(self) end
Source
# File lib/syntax_tree/node.rb, line 2666 def child_nodes [arguments] end
Also aliased as: deconstruct
Source
# File lib/syntax_tree/node.rb, line 2670 def copy(arguments: nil, location: nil) node = Break.new( arguments: arguments || self.arguments, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
Source
# File lib/syntax_tree/node.rb, line 2683 def deconstruct_keys(_keys) { arguments: arguments, location: location, comments: comments } end
Source
# File lib/syntax_tree/node.rb, line 2687 def format(q) FlowControlFormatter.new("break", self).format(q) end