Class: Prism::SourceEncodingNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::SourceEncodingNode
- Defined in:
- lib/prism/node.rb,
sig/generated/prism/node.rbs,
ext/prism/api_node.c
Overview
Class Method Summary collapse
-
.type ⇒ :source_encoding_node
See
Node.type.
Instance Method Summary collapse
-
#===(other) ⇒ boolish
: (untyped other) -> boolish.
-
#accept(visitor) ⇒ Object
See Node.accept.
-
#child_nodes ⇒ Array[node?]
(also: #deconstruct)
See Node.child_nodes.
-
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags) ⇒ SourceEncodingNode
:call-seq: copy(**fields) -> SourceEncodingNode.
-
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped].
-
#each_child_node {|arg0| ... } ⇒ Object
See Node.each_child_node.
-
#initialize(source, node_id, location, flags) ⇒ SourceEncodingNode
constructor
Initialize a new SourceEncodingNode node.
-
#inspect ⇒ String
: () -> String.
-
#type ⇒ :source_encoding_node
See
Node#type.
Constructor Details
#initialize(source, node_id, location, flags) ⇒ SourceEncodingNode
Initialize a new SourceEncodingNode node.
: (Source source, Integer node_id, Location location, Integer flags, ) -> void
30295 30296 30297 30298 30299 30300 |
# File 'lib/prism/node.rb', line 30295 def initialize(source, node_id, location, flags) @source = source @node_id = node_id @location = location @flags = flags end |
Class Method Details
.type ⇒ :source_encoding_node
See Node.type.
: () -> :source_encoding_node
30377 30378 30379 |
# File 'lib/prism/node.rb', line 30377 def self.type :source_encoding_node end |
Instance Method Details
#===(other) ⇒ boolish
: (untyped other) -> boolish
30393 30394 30395 |
# File 'lib/prism/node.rb', line 30393 def ===(other) # :nodoc: other.is_a?(SourceEncodingNode) end |
#accept(visitor) ⇒ Object
See Node.accept.
: (_Visitor visitor) -> untyped
30316 30317 30318 |
# File 'lib/prism/node.rb', line 30316 def accept(visitor) visitor.visit_source_encoding_node(self) end |
#child_nodes ⇒ Array[node?] Also known as: deconstruct
See Node.child_nodes.
: () -> Array
30323 30324 30325 |
# File 'lib/prism/node.rb', line 30323 def child_nodes [] end |
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
: () -> Array
30339 30340 30341 |
# File 'lib/prism/node.rb', line 30339 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags) ⇒ SourceEncodingNode
:call-seq:
copy(**fields) -> SourceEncodingNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ) -> SourceEncodingNode
30349 30350 30351 |
# File 'lib/prism/node.rb', line 30349 def copy(node_id: self.node_id, location: self.location, flags: self.flags) SourceEncodingNode.new(source, node_id, location, flags) end |
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
30356 30357 30358 30359 30360 30361 30362 30363 30364 30365 |
# File 'lib/prism/node.rb', line 30356 def deconstruct_keys(keys) # :nodoc: (keys || %i[node_id location]).each_with_object( {} #: Hash[Symbol, untyped] ) do |key, deconstructed| case key when :node_id then deconstructed[:node_id] = self.node_id when :location then deconstructed[:location] = self.location end end end |
#each_child_node ⇒ Enumerator[node, void] #each_child_node ⇒ void
See Node.each_child_node.
: () -> Enumerator[node, void] : () { (node) -> void } -> void
30331 30332 30333 30334 |
# File 'lib/prism/node.rb', line 30331 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ String
: () -> String
30382 30383 30384 |
# File 'lib/prism/node.rb', line 30382 def inspect # :nodoc: InspectVisitor.compose(self) end |
#type ⇒ :source_encoding_node
See Node#type.
: () -> :source_encoding_node
30370 30371 30372 |
# File 'lib/prism/node.rb', line 30370 def type :source_encoding_node end |