Class: Prism::NumberedParametersNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::NumberedParametersNode
- Defined in:
- lib/prism/node.rb,
ext/prism/api_node.c
Overview
Represents an implicit set of parameters through the use of numbered parameters within a block or lambda.
-> { _1 + _2 }
^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#maximum ⇒ Object
readonly
attr_reader maximum: Integer.
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, maximum: self.maximum) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?maximum: Integer) -> NumberedParametersNode.
-
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, maximum: Integer }.
-
#initialize(source, node_id, location, flags, maximum) ⇒ NumberedParametersNode
constructor
Initialize a new NumberedParametersNode node.
-
#inspect ⇒ Object
def inspect -> String.
-
#type ⇒ Object
Return a symbol representation of this node type.
Constructor Details
#initialize(source, node_id, location, flags, maximum) ⇒ NumberedParametersNode
Initialize a new NumberedParametersNode node.
13853 13854 13855 13856 13857 13858 13859 |
# File 'lib/prism/node.rb', line 13853 def initialize(source, node_id, location, flags, maximum) @source = source @node_id = node_id @location = location @flags = flags @maximum = maximum end |
Instance Attribute Details
#maximum ⇒ Object (readonly)
attr_reader maximum: Integer
13895 13896 13897 |
# File 'lib/prism/node.rb', line 13895 def maximum @maximum end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
13908 13909 13910 |
# File 'lib/prism/node.rb', line 13908 def self.type :numbered_parameters_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.
13914 13915 13916 13917 |
# File 'lib/prism/node.rb', line 13914 def ===(other) other.is_a?(NumberedParametersNode) && (maximum === other.maximum) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
13862 13863 13864 |
# File 'lib/prism/node.rb', line 13862 def accept(visitor) visitor.visit_numbered_parameters_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array
13867 13868 13869 |
# File 'lib/prism/node.rb', line 13867 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
13877 13878 13879 |
# File 'lib/prism/node.rb', line 13877 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
13872 13873 13874 |
# File 'lib/prism/node.rb', line 13872 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, maximum: self.maximum) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?maximum: Integer) -> NumberedParametersNode
13882 13883 13884 |
# File 'lib/prism/node.rb', line 13882 def copy(node_id: self.node_id, location: self.location, flags: self.flags, maximum: self.maximum) NumberedParametersNode.new(source, node_id, location, flags, maximum) end |
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, maximum: Integer }
13890 13891 13892 |
# File 'lib/prism/node.rb', line 13890 def deconstruct_keys(keys) { node_id: node_id, location: location, maximum: maximum } end |
#inspect ⇒ Object
def inspect -> String
13898 13899 13900 |
# File 'lib/prism/node.rb', line 13898 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
13903 13904 13905 |
# File 'lib/prism/node.rb', line 13903 def type :numbered_parameters_node end |