instance method
Prism::Translation::Ripper#visit_hash_pattern_node
visit_hash_pattern_node(node)
lib/prism/translation/ripper.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/prism/translation/ripper.rb, line 1891
def visit_hash_pattern_node(node)
constant = visit(node.constant)
elements =
if node.elements.any? || !node.rest.nil?
node.elements.map do |element|
[
if (key = element.key).opening_loc.nil?
visit(key)
else
bounds(key.value_loc)
if (value = key.value).empty?
on_string_content
else
on_string_add(on_string_content, on_tstring_content(value))
end
end,
visit(element.value)
]
end
end
rest =
case node.rest
when AssocSplatNode
visit(node.rest.value)
when NoKeywordsParameterNode
bounds(node.rest.location)
on_var_field(visit(node.rest))
end
bounds(node.location)
on_hshptn(constant, elements, rest)
end
foo => {} ^^