Class: Prism::SourceLineNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::SourceLineNode
- Defined in:
- lib/prism/node.rb,
ext/prism/api_node.c
Overview
Represents the use of the ‘__LINE__` keyword.
__LINE__
^^^^^^^^
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) -> SourceLineNode.
-
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location }.
-
#initialize(source, node_id, location, flags) ⇒ SourceLineNode
constructor
Initialize a new SourceLineNode node.
-
#inspect ⇒ Object
def inspect -> String.
-
#type ⇒ Object
Return a symbol representation of this node type.
Constructor Details
#initialize(source, node_id, location, flags) ⇒ SourceLineNode
Initialize a new SourceLineNode node.
15031 15032 15033 15034 15035 15036 |
# File 'lib/prism/node.rb', line 15031 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`.
15082 15083 15084 |
# File 'lib/prism/node.rb', line 15082 def self.type :source_line_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.
15088 15089 15090 |
# File 'lib/prism/node.rb', line 15088 def ===(other) other.is_a?(SourceLineNode) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
15039 15040 15041 |
# File 'lib/prism/node.rb', line 15039 def accept(visitor) visitor.visit_source_line_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
15044 15045 15046 |
# File 'lib/prism/node.rb', line 15044 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
15054 15055 15056 |
# File 'lib/prism/node.rb', line 15054 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
15049 15050 15051 |
# File 'lib/prism/node.rb', line 15049 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) -> SourceLineNode
15059 15060 15061 |
# File 'lib/prism/node.rb', line 15059 def copy(node_id: self.node_id, location: self.location, flags: self.flags) SourceLineNode.new(source, node_id, location, flags) end |
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location }
15067 15068 15069 |
# File 'lib/prism/node.rb', line 15067 def deconstruct_keys(keys) { node_id: node_id, location: location } end |
#inspect ⇒ Object
def inspect -> String
15072 15073 15074 |
# File 'lib/prism/node.rb', line 15072 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
15077 15078 15079 |
# File 'lib/prism/node.rb', line 15077 def type :source_line_node end |