class Prism::PinnedExpressionNode
Represents the use of the ^ operator for pinning an expression in a pattern matching expression.
foo in ^(bar) ^^^^^^
Represents the use of the ^ operator for pinning an expression in a pattern matching expression.
foo in ^(bar) ^^^^^^
Public Class Methods
(Source source, Integer node_id, Location location, Integer flags, Prism::node expression, Location operator_loc, Location lparen_loc, Location rparen_loc) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26527 def initialize(source, node_id, location, flags, expression, operator_loc, lparen_loc, rparen_loc) @source = source @node_id = node_id @location = location @flags = flags @expression = expression @operator_loc = operator_loc @lparen_loc = lparen_loc @rparen_loc = rparen_loc end
Initialize a new PinnedExpressionNode node.
Initialize a new PinnedExpressionNode node.
: (Source source, Integer node_id, Location location, Integer flags, Prism::node expression, Location operator_loc, Location lparen_loc, Location rparen_loc) -> void
Public Instance Methods
(untyped other) → boolish
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/node.rbs, line 17136
def ===: (untyped other) -> boolish
: (untyped other) -> boolish
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/node.rbs, line 17012
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
() → Prism::node
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26645 def expression @expression end
The expression used in the pinned expression
foo in ^(bar) ^^^
:call-seq: expression -> Node
The expression used in the pinned expression
foo in ^(bar) ^^^
: () -> Prism::node
Locations
Public Instance Methods
() → Location
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26692 def lparen_loc location = @lparen_loc return location if location.is_a?(Location) @lparen_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end
The Location of the opening parenthesis.
foo in ^(bar) ^
:category: Locations :call-seq: lparen_loc -> Location
The Location of the opening parenthesis.
foo in ^(bar) ^
: () -> Location
() → Location
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26663 def operator_loc location = @operator_loc return location if location.is_a?(Location) @operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end
The Location of the ^ operator
foo in ^(bar) ^
:category: Locations :call-seq: operator_loc -> Location
The Location of the ^ operator
foo in ^(bar) ^
: () -> Location
() → Location
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26721 def rparen_loc location = @rparen_loc return location if location.is_a?(Location) @rparen_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end
The Location of the closing parenthesis.
foo in ^(bar) ^
:category: Locations :call-seq: rparen_loc -> Location
The Location of the closing parenthesis.
foo in ^(bar) ^
: () -> Location
Node Interface
These methods are present on all subclasses of Node. Read the node interface docs for more information.
Public Class Methods
Public Instance Methods
(_Visitor visitor) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26552 def accept(visitor) visitor.visit_pinned_expression_node(self) end
() → Array[node?]
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26559 def child_nodes [expression] end
() → Array[node]
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26576 def compact_child_nodes [expression] end
(?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node, ?operator_loc: Location, ?lparen_loc: Location, ?rparen_loc: Location) → PinnedExpressionNode
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26586 def copy(node_id: self.node_id, location: self.location, flags: self.flags, expression: self.expression, operator_loc: self.operator_loc, lparen_loc: self.lparen_loc, rparen_loc: self.rparen_loc) PinnedExpressionNode.new(source, node_id, location, flags, expression, operator_loc, lparen_loc, rparen_loc) end
Creates a copy of self with the given fields, using self as the template.
:call-seq: copy(**fields) -> PinnedExpressionNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node, ?operator_loc: Location, ?lparen_loc: Location, ?rparen_loc: Location) -> PinnedExpressionNode
() → Enumerator[node, void]
() { (node) → void } → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26567 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? yield expression end
See Node.each_child_node.
See Node.each_child_node.
: () -> Enumerator[node, void] : () { (node) -> void } -> void
Repository
Methods related to Relocation.
Public Instance Methods
(_Repository repository) → Relocation::Entry
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26703 def save_lparen_loc(repository) repository.enter(node_id, :lparen_loc) end
Save the lparen_loc location using the given saved source so that it can be retrieved later.
:category: Repository Save the lparen_loc location using the given saved source so that it can be retrieved later.
: (_Repository repository) -> Relocation::Entry
(_Repository repository) → Relocation::Entry
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26674 def save_operator_loc(repository) repository.enter(node_id, :operator_loc) end
Save the operator_loc location using the given saved source so that it can be retrieved later.
:category: Repository Save the operator_loc location using the given saved source so that it can be retrieved later.
: (_Repository repository) -> Relocation::Entry
(_Repository repository) → Relocation::Entry
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26732 def save_rparen_loc(repository) repository.enter(node_id, :rparen_loc) end
Save the rparen_loc location using the given saved source so that it can be retrieved later.
:category: Repository Save the rparen_loc location using the given saved source so that it can be retrieved later.
: (_Repository repository) -> Relocation::Entry
Slicing
Public Instance Methods
() → String
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26754 def lparen lparen_loc.slice end
Slice the location of lparen_loc from the source.
:call-seq: lparen -> String
Slice the location of lparen_loc from the source.
: () -> String
() → String
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26744 def operator operator_loc.slice end
Slice the location of operator_loc from the source.
:call-seq: operator -> String
Slice the location of operator_loc from the source.
: () -> String
() → String
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 26764 def rparen rparen_loc.slice end
Slice the location of rparen_loc from the source.
:call-seq: rparen -> String
Slice the location of rparen_loc from the source.
: () -> String