Class: YARP::SplatNode

Inherits:
YARPNode
  • Object
show all
Defined in:
lib/yarp/node.rb,
ext/yarp/api_node.c

Overview

Represents the use of the splat operator.

[*a]
 ^^

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operator_loc, expression, location) ⇒ SplatNode

def initialize: (operator_loc: Location, expression: Node?, location: Location) -> void



5678
5679
5680
5681
5682
# File 'lib/yarp/node.rb', line 5678

def initialize(operator_loc, expression, location)
  @operator_loc = operator_loc
  @expression = expression
  @location = location
end

Instance Attribute Details

#expressionObject (readonly)

attr_reader expression: Node?



5675
5676
5677
# File 'lib/yarp/node.rb', line 5675

def expression
  @expression
end

#operator_locObject (readonly)

attr_reader operator_loc: Location



5672
5673
5674
# File 'lib/yarp/node.rb', line 5672

def operator_loc
  @operator_loc
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



5685
5686
5687
# File 'lib/yarp/node.rb', line 5685

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

#child_nodesObject Also known as: deconstruct

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



5690
5691
5692
# File 'lib/yarp/node.rb', line 5690

def child_nodes
  [expression]
end

#deconstruct_keys(keys) ⇒ Object

def deconstruct_keys: (keys: Array) -> Hash[Symbol, nil | Node | Array | String | Token | Array | Location]



5698
5699
5700
# File 'lib/yarp/node.rb', line 5698

def deconstruct_keys(keys)
  { operator_loc: operator_loc, expression: expression, location: location }
end

#operatorObject

def operator: () -> String



5703
5704
5705
# File 'lib/yarp/node.rb', line 5703

def operator
  operator_loc.slice
end