Class: Prism::SourceEncodingNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::SourceEncodingNode
- Defined in:
- lib/prism/node.rb,
ext/prism/api_node.c
Overview
Represents the use of the ‘__ENCODING__` keyword.
__ENCODING__
^^^^^^^^^^^^
Class Method Summary collapse
-
.type ⇒ Object
Return a symbol representation of this node type.
Instance Method Summary collapse
-
#===(other) ⇒ Object
Implements case-equality for the node.
-
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location].
-
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> SourceEncodingNode.
-
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location }.
-
#initialize(source, node_id, location, flags) ⇒ SourceEncodingNode
constructor
Initialize a new SourceEncodingNode node.
-
#inspect ⇒ Object
def inspect -> String.
-
#type ⇒ Object
Return a symbol representation of this node type.
Constructor Details
#initialize(source, node_id, location, flags) ⇒ SourceEncodingNode
Initialize a new SourceEncodingNode node.
16441 16442 16443 16444 16445 16446 |
# File 'lib/prism/node.rb', line 16441 def initialize(source, node_id, location, flags) @source = source @node_id = node_id @location = location @flags = flags end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
16492 16493 16494 |
# File 'lib/prism/node.rb', line 16492 def self.type :source_encoding_node end |
Instance Method Details
#===(other) ⇒ Object
Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.
16498 16499 16500 |
# File 'lib/prism/node.rb', line 16498 def ===(other) other.is_a?(SourceEncodingNode) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
16449 16450 16451 |
# File 'lib/prism/node.rb', line 16449 def accept(visitor) visitor.visit_source_encoding_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
16454 16455 16456 |
# File 'lib/prism/node.rb', line 16454 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
16464 16465 16466 |
# File 'lib/prism/node.rb', line 16464 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
16459 16460 16461 |
# File 'lib/prism/node.rb', line 16459 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> SourceEncodingNode
16469 16470 16471 |
# File 'lib/prism/node.rb', line 16469 def copy(node_id: self.node_id, location: self.location, flags: self.flags) SourceEncodingNode.new(source, node_id, location, flags) end |
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location }
16477 16478 16479 |
# File 'lib/prism/node.rb', line 16477 def deconstruct_keys(keys) { node_id: node_id, location: location } end |
#inspect ⇒ Object
def inspect -> String
16482 16483 16484 |
# File 'lib/prism/node.rb', line 16482 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
16487 16488 16489 |
# File 'lib/prism/node.rb', line 16487 def type :source_encoding_node end |