Represents the use of a case statement for pattern matching.

case true
in false
end
^^^^^^^^^
Attributes
Read

Represents the predicate of the case match. This can be either ‘nil` or any [non-void expressions](github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).

case true; in false; end
^^^^
Read

Represents the conditions of the case match.

case true; in false; end
           ^^^^^^^^

Represents the else clause of the case match.

case true; in false; else; end
                     ^^^^
Class Methods

Initialize a new CaseMatchNode node.

Return a symbol representation of this node type. See ‘Node::type`.

Instance Methods

Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.

def accept: (Visitor visitor) -> void

def case_keyword: () -> String

Represents the location of the ‘case` keyword.

case true; in false; end
^^^^

def child_nodes: () -> Array[nil | Node]

def comment_targets: () -> Array[Node | Location]

Returns the else clause of the case match node. This method is deprecated in favor of else_clause.

def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?predicate: Prism::node?, ?conditions: Array, ?else_clause: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location) -> CaseMatchNode

An alias for child_nodes

def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, predicate: Prism::node?, conditions: Array, else_clause: ElseNode?, case_keyword_loc: Location, end_keyword_loc: Location }

def end_keyword: () -> String

Represents the location of the ‘end` keyword.

case true; in false; end
                     ^^^

def inspect -> String

Save the case_keyword_loc location using the given saved source so that it can be retrieved later.

Save the end_keyword_loc location using the given saved source so that it can be retrieved later.

Return a symbol representation of this node type. See ‘Node#type`.