class YARP::UnlessNode
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/yarp/node.rbs class YARP::UnlessNode < YARP::Node def child_nodes: () -> Array[YARP::OrNode] end
^^^^^^^^^^^^^^^^^^^^^^^
unless foo then bar end
^^^^^^^^^^^^^^
bar unless foo
Represents the use of the ‘unless` keyword, either in the block form or the modifier form.
def accept(visitor)
def accept(visitor) visitor.visit_unless_node(self) end
def child_nodes
Experimental RBS support (using type sampling data from the type_fusion
project).
def child_nodes: () -> YARP::StatementsNode | NilClass
This signature was generated using 1 sample from 1 application.
def child_nodes [predicate, statements, consequent] end
def comment_targets
def comment_targets [keyword_loc, predicate, *statements, *consequent, *end_keyword_loc] end
def copy(**params)
def copy(**params) UnlessNode.new( params.fetch(:keyword_loc) { keyword_loc }, params.fetch(:predicate) { predicate }, params.fetch(:statements) { statements }, params.fetch(:consequent) { consequent }, params.fetch(:end_keyword_loc) { end_keyword_loc }, params.fetch(:location) { location }, ) end
def deconstruct_keys(keys)
def deconstruct_keys(keys) { keyword_loc: keyword_loc, predicate: predicate, statements: statements, consequent: consequent, end_keyword_loc: end_keyword_loc, location: location } end
def end_keyword
def end_keyword end_keyword_loc&.slice end
def initialize(keyword_loc, predicate, statements, consequent, end_keyword_loc, location)
def initialize(keyword_loc, predicate, statements, consequent, end_keyword_loc, location) @keyword_loc = keyword_loc @predicate = predicate @statements = statements @consequent = consequent @end_keyword_loc = end_keyword_loc @location = location end
def inspect(inspector = NodeInspector.new)
def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n" inspector << "├── predicate:\n" inspector << inspector.child_node(predicate, "│ ") if (statements = self.statements).nil? inspector << "├── statements: ∅\n" else inspector << "├── statements:\n" inspector << statements.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix) end if (consequent = self.consequent).nil? inspector << "├── consequent: ∅\n" else inspector << "├── consequent:\n" inspector << consequent.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix) end inspector << "└── end_keyword_loc: #{inspector.location(end_keyword_loc)}\n" inspector.to_str end
def keyword
def keyword keyword_loc.slice end
def set_newline_flag(newline_marked)
def set_newline_flag(newline_marked) predicate.set_newline_flag(newline_marked) end