class Prism::PreExecutionNode
Represents the use of the BEGIN keyword.
BEGIN { foo } ^^^^^^^^^^^^^
Represents the use of the BEGIN keyword.
BEGIN { foo } ^^^^^^^^^^^^^
Public Class Methods
(Source source, Integer node_id, Location location, Integer flags, StatementsNode? statements, Location keyword_loc, Location opening_loc, Location closing_loc) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 27223 def initialize(source, node_id, location, flags, statements, keyword_loc, opening_loc, closing_loc) @source = source @node_id = node_id @location = location @flags = flags @statements = statements @keyword_loc = keyword_loc @opening_loc = opening_loc @closing_loc = closing_loc end
Initialize a new PreExecutionNode node.
Initialize a new PreExecutionNode node.
: (Source source, Integer node_id, Location location, Integer flags, StatementsNode? statements, Location keyword_loc, Location opening_loc, Location closing_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 17560
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 17464
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.rbs, line 17477
def inspect: () -> String
: () -> String
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 27336 def statements @statements end
Returns the statements attribute.
:call-seq: statements -> StatementsNode | nil
Returns the statements attribute.
: () -> StatementsNode?
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 27391 def closing_loc location = @closing_loc return location if location.is_a?(Location) @closing_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end
Returns the Location represented by closing_loc.
:category: Locations :call-seq: closing_loc -> Location
Returns the Location represented by closing_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 27347 def keyword_loc location = @keyword_loc return location if location.is_a?(Location) @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end
Returns the Location represented by keyword_loc.
:category: Locations :call-seq: keyword_loc -> Location
Returns the Location represented by 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 27369 def opening_loc location = @opening_loc return location if location.is_a?(Location) @opening_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end
Returns the Location represented by opening_loc.
:category: Locations :call-seq: opening_loc -> Location
Returns the Location represented by opening_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 27248 def accept(visitor) visitor.visit_pre_execution_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 27255 def child_nodes [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 27272 def compact_child_nodes compact = [] #: Array[Prism::node] if (statements = self.statements); compact << statements; end compact end
(?node_id: Integer, ?location: Location, ?flags: Integer, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) → PreExecutionNode
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/lib/prism/node.rb, line 27284 def copy(node_id: self.node_id, location: self.location, flags: self.flags, statements: self.statements, keyword_loc: self.keyword_loc, opening_loc: self.opening_loc, closing_loc: self.closing_loc) PreExecutionNode.new(source, node_id, location, flags, statements, keyword_loc, opening_loc, closing_loc) end
Creates a copy of self with the given fields, using self as the template.
:call-seq: copy(**fields) -> PreExecutionNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) -> PreExecutionNode
() → 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 27263 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? 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 27402 def save_closing_loc(repository) repository.enter(node_id, :closing_loc) end
Save the closing_loc location using the given saved source so that it can be retrieved later.
:category: Repository Save the closing_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 27358 def save_keyword_loc(repository) repository.enter(node_id, :keyword_loc) end
Save the keyword_loc location using the given saved source so that it can be retrieved later.
:category: Repository Save the 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 27380 def save_opening_loc(repository) repository.enter(node_id, :opening_loc) end
Save the opening_loc location using the given saved source so that it can be retrieved later.
:category: Repository Save the opening_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 27434 def closing closing_loc.slice end
Slice the location of closing_loc from the source.
:call-seq: closing -> String
Slice the location of closing_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 27414 def keyword keyword_loc.slice end
Slice the location of keyword_loc from the source.
:call-seq: keyword -> String
Slice the location of keyword_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 27424 def opening opening_loc.slice end
Slice the location of opening_loc from the source.
:call-seq: opening -> String
Slice the location of opening_loc from the source.
: () -> String