class SyntaxTree::UntilNode
Until represents an until
loop.
until predicate end
Attributes
Node
-
the expression to be checked
Statements
-
the expressions to be executed
Public Class Methods
Source
# File lib/syntax_tree/node.rb, line 11479 def initialize(predicate:, statements:, location:) @predicate = predicate @statements = statements @location = location @comments = [] end
Public Instance Methods
Source
# File lib/syntax_tree/node.rb, line 11521 def ===(other) other.is_a?(UntilNode) && predicate === other.predicate && statements === other.statements end
Source
# File lib/syntax_tree/node.rb, line 11486 def accept(visitor) visitor.visit_until(self) end
Source
# File lib/syntax_tree/node.rb, line 11490 def child_nodes [predicate, statements] end
Also aliased as: deconstruct
Source
# File lib/syntax_tree/node.rb, line 11494 def copy(predicate: nil, statements: nil, location: nil) node = UntilNode.new( predicate: predicate || self.predicate, statements: statements || self.statements, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
Source
# File lib/syntax_tree/node.rb, line 11508 def deconstruct_keys(_keys) { predicate: predicate, statements: statements, location: location, comments: comments } end
Source
# File lib/syntax_tree/node.rb, line 11517 def format(q) LoopFormatter.new("until", self).format(q) end
Source
# File lib/syntax_tree/node.rb, line 11526 def modifier? predicate.location.start_char > statements.location.start_char end