class YARP::KeywordHashNode

Represents a hash literal without opening and closing braces.

foo(a: b)
    ^^^^

Attributes

elements[R]

attr_reader elements: Array

Public Class Methods

new(elements, location) click to toggle source

def initialize: (elements: Array, location: Location) -> void

# File yarp/node.rb, line 6388
def initialize(elements, location)
  @elements = elements
  @location = location
end

Public Instance Methods

accept(visitor) click to toggle source

def accept: (visitor: Visitor) -> void

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

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

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

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

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

def copy: (**params) -> KeywordHashNode

# File yarp/node.rb, line 6409
def copy(**params)
  KeywordHashNode.new(
    params.fetch(:elements) { elements },
    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 6420
def deconstruct_keys(keys)
  { elements: elements, location: location }
end
inspect(inspector = NodeInspector.new) click to toggle source
# File yarp/node.rb, line 6424
def inspect(inspector = NodeInspector.new)
  inspector << inspector.header(self)
  inspector << "└── elements: #{inspector.list("#{inspector.prefix}    ", elements)}"
  inspector.to_str
end