Class: Prism::ItParametersNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::ItParametersNode
- 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 the it keyword within a block or lambda.
-> { it + it }
^^^^^^^^^^^^^^
Class Method Summary collapse
-
.type ⇒ :it_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) ⇒ ItParametersNode
:call-seq: copy(**fields) -> ItParametersNode.
-
#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) ⇒ ItParametersNode
constructor
Initialize a new ItParametersNode node.
-
#inspect ⇒ String
: () -> String.
-
#type ⇒ :it_parameters_node
See
Node#type.
Constructor Details
#initialize(source, node_id, location, flags) ⇒ ItParametersNode
Initialize a new ItParametersNode node.
: (Source source, Integer node_id, Location location, Integer flags, ) -> void
20647 20648 20649 20650 20651 20652 |
# File 'lib/prism/node.rb', line 20647 def initialize(source, node_id, location, flags) @source = source @node_id = node_id @location = location @flags = flags end |
Class Method Details
.type ⇒ :it_parameters_node
See Node.type.
: () -> :it_parameters_node
20729 20730 20731 |
# File 'lib/prism/node.rb', line 20729 def self.type :it_parameters_node end |
Instance Method Details
#===(other) ⇒ boolish
: (untyped other) -> boolish
20745 20746 20747 |
# File 'lib/prism/node.rb', line 20745 def ===(other) # :nodoc: other.is_a?(ItParametersNode) end |
#accept(visitor) ⇒ Object
See Node.accept.
: (_Visitor visitor) -> untyped
20668 20669 20670 |
# File 'lib/prism/node.rb', line 20668 def accept(visitor) visitor.visit_it_parameters_node(self) end |
#child_nodes ⇒ Array[node?] Also known as: deconstruct
See Node.child_nodes.
: () -> Array
20675 20676 20677 |
# File 'lib/prism/node.rb', line 20675 def child_nodes [] end |
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
: () -> Array
20691 20692 20693 |
# File 'lib/prism/node.rb', line 20691 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags) ⇒ ItParametersNode
:call-seq:
copy(**fields) -> ItParametersNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ) -> ItParametersNode
20701 20702 20703 |
# File 'lib/prism/node.rb', line 20701 def copy(node_id: self.node_id, location: self.location, flags: self.flags) ItParametersNode.new(source, node_id, location, flags) end |
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
20708 20709 20710 20711 20712 20713 20714 20715 20716 20717 |
# File 'lib/prism/node.rb', line 20708 def deconstruct_keys(keys) # :nodoc: (keys || %i[node_id location]).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 end end end |
#each_child_node ⇒ Enumerator[node, void] #each_child_node ⇒ void
See Node.each_child_node.
: () -> Enumerator[node, void] : () { (node) -> void } -> void
20683 20684 20685 20686 |
# File 'lib/prism/node.rb', line 20683 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ String
: () -> String
20734 20735 20736 |
# File 'lib/prism/node.rb', line 20734 def inspect # :nodoc: InspectVisitor.compose(self) end |
#type ⇒ :it_parameters_node
See Node#type.
: () -> :it_parameters_node
20722 20723 20724 |
# File 'lib/prism/node.rb', line 20722 def type :it_parameters_node end |