Class: Prism::ImplicitRestNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::ImplicitRestNode
- Defined in:
- lib/prism/node.rb,
ext/prism/api_node.c
Overview
Represents using a trailing comma to indicate an implicit rest parameter.
foo { |bar,| }
^
foo in [bar,]
^
for foo, in bar do end
^
foo, = bar
^
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) -> ImplicitRestNode.
-
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location }.
-
#each_child_node ⇒ Object
def each_child_node: () { (Prism::node) -> void } -> void | () -> Enumerator.
-
#initialize(source, node_id, location, flags) ⇒ ImplicitRestNode
constructor
Initialize a new ImplicitRestNode node.
-
#inspect ⇒ Object
def inspect -> String.
-
#type ⇒ Object
Return a symbol representation of this node type.
Constructor Details
#initialize(source, node_id, location, flags) ⇒ ImplicitRestNode
Initialize a new ImplicitRestNode node.
9484 9485 9486 9487 9488 9489 |
# File 'lib/prism/node.rb', line 9484 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.
9541 9542 9543 |
# File 'lib/prism/node.rb', line 9541 def self.type :implicit_rest_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.
9547 9548 9549 |
# File 'lib/prism/node.rb', line 9547 def ===(other) other.is_a?(ImplicitRestNode) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
9492 9493 9494 |
# File 'lib/prism/node.rb', line 9492 def accept(visitor) visitor.visit_implicit_rest_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array
9497 9498 9499 |
# File 'lib/prism/node.rb', line 9497 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
9513 9514 9515 |
# File 'lib/prism/node.rb', line 9513 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
9508 9509 9510 |
# File 'lib/prism/node.rb', line 9508 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) -> ImplicitRestNode
9518 9519 9520 |
# File 'lib/prism/node.rb', line 9518 def copy(node_id: self.node_id, location: self.location, flags: self.flags) ImplicitRestNode.new(source, node_id, location, flags) end |
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location }
9526 9527 9528 |
# File 'lib/prism/node.rb', line 9526 def deconstruct_keys(keys) { node_id: node_id, location: location } end |
#each_child_node ⇒ Object
def each_child_node: () { (Prism::node) -> void } -> void | () -> Enumerator
9502 9503 9504 9505 |
# File 'lib/prism/node.rb', line 9502 def each_child_node return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ Object
def inspect -> String
9531 9532 9533 |
# File 'lib/prism/node.rb', line 9531 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
9536 9537 9538 |
# File 'lib/prism/node.rb', line 9536 def type :implicit_rest_node end |