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.
-
#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.
16843 16844 16845 16846 16847 16848 |
# File 'lib/prism/node.rb', line 16843 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`.
16894 16895 16896 |
# File 'lib/prism/node.rb', line 16894 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.
16900 16901 16902 |
# File 'lib/prism/node.rb', line 16900 def ===(other) other.is_a?(SourceLineNode) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
16851 16852 16853 |
# File 'lib/prism/node.rb', line 16851 def accept(visitor) visitor.visit_source_line_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array
16856 16857 16858 |
# File 'lib/prism/node.rb', line 16856 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
16866 16867 16868 |
# File 'lib/prism/node.rb', line 16866 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
16861 16862 16863 |
# File 'lib/prism/node.rb', line 16861 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
16871 16872 16873 |
# File 'lib/prism/node.rb', line 16871 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 }
16879 16880 16881 |
# File 'lib/prism/node.rb', line 16879 def deconstruct_keys(keys) { node_id: node_id, location: location } end |
#inspect ⇒ Object
def inspect -> String
16884 16885 16886 |
# File 'lib/prism/node.rb', line 16884 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
16889 16890 16891 |
# File 'lib/prism/node.rb', line 16889 def type :source_line_node end |