def extract_hash_pair(node, key)
      node.children.detect do |child|
        next unless child.type == :pair
        key_node = child.children[0]
        %i[sym str].include?(key_node.type) && key_node.children[0].to_s == key
      end
    end
def extract_hash_pair(node, key)
      node.children.detect do |child|
        next unless child.type == :pair
        key_node = child.children[0]
        %i[sym str].include?(key_node.type) && key_node.children[0].to_s == key
      end
    end
Extract a hash pair with a given literal key.

 @param node [AST::Node] a node of type `:hash`.
 @param key [String] node key as a string (indifferent symbol-string matching).
 @return [AST::Node, nil] a node of type `:pair` or nil.