class Prism::InNode
Represents the use of the in keyword in a case statement.
case a; in b then c end ^^^^^^^^^^^
Represents the use of the in keyword in a case statement.
case a; in b then c end ^^^^^^^^^^^
:stopdoc:
Public Class Methods
(Source source, Integer node_id, Location location, Integer flags, Prism::node pattern, StatementsNode? statements, Location in_keyword_loc, Location? then_keyword_loc) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 16380 def initialize(source, node_id, location, flags, pattern, statements, in_keyword_loc, then_keyword_loc) @source = source @node_id = node_id @location = location @flags = flags @pattern = pattern @statements = statements @in_keyword_loc = in_keyword_loc @then_keyword_loc = then_keyword_loc end
Initialize a new InNode node.
Initialize a new InNode node.
: (Source source, Integer node_id, Location location, Integer flags, Prism::node pattern, StatementsNode? statements, Location in_keyword_loc, Location? then_keyword_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 10667
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 10587
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/node_ext.rbs, line 219
def in: () -> String
: () -> String
() → Location
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/node_ext.rbs, line 222
def in_loc: () -> Location
: () -> Location
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/node.rbs, line 10600
def inspect: () -> String
: () -> String
() → Prism::node
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 16494 def pattern @pattern end
Returns the pattern attribute.
:call-seq: pattern -> Node
Returns the pattern attribute.
: () -> Prism::node
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 16504 def statements @statements end
Returns the statements attribute.
:call-seq: statements -> StatementsNode | nil
Returns the statements attribute.
: () -> StatementsNode?
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/node_ext.rbs, line 225
def then: () -> String?
: () -> String?
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 16515 def in_keyword_loc location = @in_keyword_loc return location if location.is_a?(Location) @in_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end
Returns the Location represented by in_keyword_loc.
:category: Locations :call-seq: in_keyword_loc -> Location
Returns the Location represented by in_keyword_loc.
: () -> Location
() → Location?
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 16537 def then_keyword_loc location = @then_keyword_loc case location when nil nil when Location location else @then_keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end end
Returns the Location represented by then_keyword_loc.
:category: Locations :call-seq: then_keyword_loc -> Location | nil
Returns the Location represented by then_keyword_loc.
: () -> 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 16405 def accept(visitor) visitor.visit_in_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 16412 def child_nodes [pattern, statements] 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 16430 def compact_child_nodes compact = [] #: Array[Prism::node] compact << pattern if (statements = self.statements); compact << statements; end compact end
(?node_id: Integer, ?location: Location, ?flags: Integer, ?pattern: Prism::node, ?statements: StatementsNode?, ?in_keyword_loc: Location, ?then_keyword_loc: Location?) → InNode
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 16443 def copy(node_id: self.node_id, location: self.location, flags: self.flags, pattern: self.pattern, statements: self.statements, in_keyword_loc: self.in_keyword_loc, then_keyword_loc: self.then_keyword_loc) InNode.new(source, node_id, location, flags, pattern, statements, in_keyword_loc, then_keyword_loc) end
Creates a copy of self with the given fields, using self as the template.
:call-seq: copy(**fields) -> InNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?pattern: Prism::node, ?statements: StatementsNode?, ?in_keyword_loc: Location, ?then_keyword_loc: Location?) -> InNode
() → 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 16420 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? yield pattern if (statements = self.statements); yield statements; end 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 16526 def save_in_keyword_loc(repository) repository.enter(node_id, :in_keyword_loc) end
Save the in_keyword_loc location using the given saved source so that it can be retrieved later.
:category: Repository Save the in_keyword_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 16554 def save_then_keyword_loc(repository) repository.enter(node_id, :then_keyword_loc) unless @then_keyword_loc.nil? end
Save the then_keyword_loc location using the given saved source so that it can be retrieved later.
:category: Repository Save the then_keyword_loc location using the given saved source so that it can be retrieved later.
: (_Repository repository) -> Relocation::Entry?
Slicing
Public Instance Methods
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 16565 def in_keyword in_keyword_loc.slice end
Slice the location of in_keyword_loc from the source.
:call-seq: in_keyword -> String
Slice the location of in_keyword_loc from the source.
: () -> String
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 16575 def then_keyword then_keyword_loc&.slice end
Slice the location of then_keyword_loc from the source.
:call-seq: then_keyword -> String | nil
Slice the location of then_keyword_loc from the source.
: () -> String?