Class: Prism::NumberedParametersNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::NumberedParametersNode
- Defined in:
- lib/prism/node.rb,
sig/generated/prism/node.rbs,
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 }
^^^^^^^^^^^^^^
Class Method Summary collapse
-
.type ⇒ :numbered_parameters_node
See
Node.type.
Instance Method Summary collapse
-
#===(other) ⇒ boolish
: (untyped other) -> boolish.
-
#accept(visitor) ⇒ Object
See Node.accept.
-
#child_nodes ⇒ Array[node?]
(also: #deconstruct)
See Node.child_nodes.
-
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags, maximum: self.maximum) ⇒ NumberedParametersNode
:call-seq: copy(**fields) -> NumberedParametersNode.
-
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped].
-
#each_child_node {|arg0| ... } ⇒ Object
See Node.each_child_node.
-
#initialize(source, node_id, location, flags, maximum) ⇒ NumberedParametersNode
constructor
Initialize a new NumberedParametersNode node.
-
#inspect ⇒ String
: () -> String.
-
#maximum ⇒ Integer
:call-seq: maximum -> Integer.
-
#type ⇒ :numbered_parameters_node
See
Node#type.
Constructor Details
#initialize(source, node_id, location, flags, maximum) ⇒ NumberedParametersNode
Initialize a new NumberedParametersNode node.
: (Source source, Integer node_id, Location location, Integer flags, Integer maximum) -> void
25195 25196 25197 25198 25199 25200 25201 |
# File 'lib/prism/node.rb', line 25195 def initialize(source, node_id, location, flags, maximum) @source = source @node_id = node_id @location = location @flags = flags @maximum = maximum end |
Class Method Details
.type ⇒ :numbered_parameters_node
See Node.type.
: () -> :numbered_parameters_node
25279 25280 25281 |
# File 'lib/prism/node.rb', line 25279 def self.type :numbered_parameters_node end |
Instance Method Details
#===(other) ⇒ boolish
: (untyped other) -> boolish
25305 25306 25307 25308 |
# File 'lib/prism/node.rb', line 25305 def ===(other) # :nodoc: other.is_a?(NumberedParametersNode) && (maximum === other.maximum) end |
#accept(visitor) ⇒ Object
See Node.accept.
: (_Visitor visitor) -> untyped
25217 25218 25219 |
# File 'lib/prism/node.rb', line 25217 def accept(visitor) visitor.visit_numbered_parameters_node(self) end |
#child_nodes ⇒ Array[node?] Also known as: deconstruct
See Node.child_nodes.
: () -> Array
25224 25225 25226 |
# File 'lib/prism/node.rb', line 25224 def child_nodes [] end |
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
: () -> Array
25240 25241 25242 |
# File 'lib/prism/node.rb', line 25240 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, maximum: self.maximum) ⇒ NumberedParametersNode
:call-seq:
copy(**fields) -> NumberedParametersNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?maximum: Integer) -> NumberedParametersNode
25250 25251 25252 |
# File 'lib/prism/node.rb', line 25250 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) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
25257 25258 25259 25260 25261 25262 25263 25264 25265 25266 25267 |
# File 'lib/prism/node.rb', line 25257 def deconstruct_keys(keys) # :nodoc: (keys || %i[node_id location maximum]).each_with_object( {} #: Hash[Symbol, untyped] ) do |key, deconstructed| case key when :node_id then deconstructed[:node_id] = self.node_id when :location then deconstructed[:location] = self.location when :maximum then deconstructed[:maximum] = self.maximum end end end |
#each_child_node ⇒ Enumerator[node, void] #each_child_node ⇒ void
See Node.each_child_node.
: () -> Enumerator[node, void] : () { (node) -> void } -> void
25232 25233 25234 25235 |
# File 'lib/prism/node.rb', line 25232 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ String
: () -> String
25284 25285 25286 |
# File 'lib/prism/node.rb', line 25284 def inspect # :nodoc: InspectVisitor.compose(self) end |
#maximum ⇒ Integer
:call-seq:
maximum -> Integer
Returns the maximum attribute.
: () -> Integer
25296 25297 25298 |
# File 'lib/prism/node.rb', line 25296 def maximum @maximum end |
#type ⇒ :numbered_parameters_node
See Node#type.
: () -> :numbered_parameters_node
25272 25273 25274 |
# File 'lib/prism/node.rb', line 25272 def type :numbered_parameters_node end |