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.



11369
11370
11371
11372
11373
11374
# File 'lib/prism/node.rb', line 11369

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`.



11420
11421
11422
# File 'lib/prism/node.rb', line 11420

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.



11426
11427
11428
# File 'lib/prism/node.rb', line 11426

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

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



11377
11378
11379
# File 'lib/prism/node.rb', line 11377

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

#child_nodesObject Also known as: deconstruct

def child_nodes: () -> Array



11382
11383
11384
# File 'lib/prism/node.rb', line 11382

def child_nodes
  []
end

#comment_targetsObject

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



11392
11393
11394
# File 'lib/prism/node.rb', line 11392

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

#compact_child_nodesObject

def compact_child_nodes: () -> Array



11387
11388
11389
# File 'lib/prism/node.rb', line 11387

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



11397
11398
11399
# File 'lib/prism/node.rb', line 11397

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 }



11405
11406
11407
# File 'lib/prism/node.rb', line 11405

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

#inspectObject

def inspect -> String



11410
11411
11412
# File 'lib/prism/node.rb', line 11410

def inspect
  InspectVisitor.compose(self)
end

#typeObject

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



11415
11416
11417
# File 'lib/prism/node.rb', line 11415

def type
  :it_parameters_node
end