Class: Prism::ItParametersNode

Inherits:
PrismNode
  • Object
show all
Defined in:
lib/prism/node.rb,
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

Instance Method Summary collapse

Constructor Details

#initialize(source, node_id, location, flags) ⇒ ItParametersNode

Initialize a new ItParametersNode node.



11267
11268
11269
11270
11271
11272
# File 'lib/prism/node.rb', line 11267

def initialize(source, node_id, location, flags)
  @source = source
  @node_id = node_id
  @location = location
  @flags = flags
end

Class Method Details

.typeObject

Return a symbol representation of this node type. See ‘Node::type`.



11318
11319
11320
# File 'lib/prism/node.rb', line 11318

def self.type
  :it_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.



11324
11325
11326
# File 'lib/prism/node.rb', line 11324

def ===(other)
  other.is_a?(ItParametersNode)
end

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



11275
11276
11277
# File 'lib/prism/node.rb', line 11275

def accept(visitor)
  visitor.visit_it_parameters_node(self)
end

#child_nodesObject Also known as: deconstruct

def child_nodes: () -> Array[nil | Node]



11280
11281
11282
# File 'lib/prism/node.rb', line 11280

def child_nodes
  []
end

#comment_targetsObject

def comment_targets: () -> Array[Node | Location]



11290
11291
11292
# File 'lib/prism/node.rb', line 11290

def comment_targets
  [] #: Array[Prism::node | Location]
end

#compact_child_nodesObject

def compact_child_nodes: () -> Array



11285
11286
11287
# File 'lib/prism/node.rb', line 11285

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) -> ItParametersNode



11295
11296
11297
# File 'lib/prism/node.rb', line 11295

def copy(node_id: self.node_id, location: self.location, flags: self.flags)
  ItParametersNode.new(source, node_id, location, flags)
end

#deconstruct_keys(keys) ⇒ Object

def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location }



11303
11304
11305
# File 'lib/prism/node.rb', line 11303

def deconstruct_keys(keys)
  { node_id: node_id, location: location }
end

#inspectObject

def inspect -> String



11308
11309
11310
# File 'lib/prism/node.rb', line 11308

def inspect
  InspectVisitor.compose(self)
end

#typeObject

Return a symbol representation of this node type. See ‘Node#type`.



11313
11314
11315
# File 'lib/prism/node.rb', line 11313

def type
  :it_parameters_node
end