You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: fragment_names_are_unique.rb
    path of file: ./repos/graphql-ruby/lib/graphql/static_validation/rules
    
    the code of the file until where you have to start completion: # frozen_string_literal: true
module GraphQL
  module StaticValidation
    module FragmentNamesAreUnique

      def initialize(*)
        super
        @fragments_by_name = Hash.new { |h, k| h[k] = [] }
      end

      def on_fragment_definition(node, parent)
        @fragments_by_name[node.name] << 
    
      def on_document(_n, _p)
        super
        @fragments_by_name.each do |name, fragments|
          if fragments.length > 1
            add_error(GraphQL::StaticValidation::FragmentNamesAreUniqueError.new(
              %|Fragment name "#{name}" must be unique|,
              nodes: fragments,
              name: name
            ))
          end
        end