Represents the use of a case statement.

case true
when false
end
^^^^^^^^^^
Attributes
Read

Represents the predicate of the case statement. 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; when false; end
^^^^
Read

Represents the conditions of the case statement.

case true; when false; end
           ^^^^^^^^^^

Represents the else clause of the case statement.

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

Initialize a new CaseNode 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; when false; end
^^^^

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

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

Returns the else clause of the case 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) -> CaseNode

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; when 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`.