class YARP::SplatNode

Represents the use of the splat operator.

[*a]
 ^^

Attributes

expression[R]

attr_reader expression: Node?

operator_loc[R]

attr_reader operator_loc: Location

Public Class Methods

new(operator_loc, expression, location) click to toggle source

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

# File yarp/node.rb, line 9801
def initialize(operator_loc, expression, location)
  @operator_loc = operator_loc
  @expression = expression
  @location = location
end

Public Instance Methods

accept(visitor) click to toggle source

def accept: (visitor: Visitor) -> void

# File yarp/node.rb, line 9808
def accept(visitor)
  visitor.visit_splat_node(self)
end
child_nodes() click to toggle source

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

# File yarp/node.rb, line 9813
def child_nodes
  [expression]
end
Also aliased as: deconstruct
comment_targets() click to toggle source

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

# File yarp/node.rb, line 9818
def comment_targets
  [operator_loc, *expression]
end
copy(**params) click to toggle source

def copy: (**params) -> SplatNode

# File yarp/node.rb, line 9823
def copy(**params)
  SplatNode.new(
    params.fetch(:operator_loc) { operator_loc },
    params.fetch(:expression) { expression },
    params.fetch(:location) { location },
  )
end
deconstruct()

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

Alias for: child_nodes
deconstruct_keys(keys) click to toggle source

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

# File yarp/node.rb, line 9835
def deconstruct_keys(keys)
  { operator_loc: operator_loc, expression: expression, location: location }
end
inspect(inspector = NodeInspector.new) click to toggle source
# File yarp/node.rb, line 9844
def inspect(inspector = NodeInspector.new)
  inspector << inspector.header(self)
  inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n"
  if (expression = self.expression).nil?
    inspector << "└── expression: ∅\n"
  else
    inspector << "└── expression:\n"
    inspector << expression.inspect(inspector.child_inspector("    ")).delete_prefix(inspector.prefix)
  end
  inspector.to_str
end
operator() click to toggle source

def operator: () -> String

# File yarp/node.rb, line 9840
def operator
  operator_loc.slice
end