class Rufo::Formatter
def visit_hash_key_value(node)
def visit_hash_key_value(node) # key => value # # [:assoc_new, key, value] _, key, value = node # If a symbol comes it means it's something like # `:foo => 1` or `:"foo" => 1` and a `=>` # always follows symbol = current_token_kind == :on_symbeg arrow = symbol || !(key[0] == :@label || key[0] == :dyna_symbol) visit key # Don't output `=>` for keys that are `label: value` # or `"label": value` if arrow consume_space consume_op "=>" end if value.nil? # The value for the key is omitted. skip_space else consume_space visit value end end