<commit_before>module ContentfulRails
  class Engine < ::Rails::Engine

    isolate_namespace ContentfulRails

    #Iterate through all models which inherit from ContentfulModel::Base
    #and add an entry mapping for them, so calls to the Contentful API return
    #the appropriate classes.
    initializer "add_entry_mappings_for_contentful_models" do
      if defined?(ContentfulModel)
        Rails.application.eager_load!
        ContentfulModel::Base.descendents.each do |klass|
          klass.send(:add_entry_mapping)
        end
      end
    end

    initializer "add_contentful_mime_type" do
      Mime::Type.register "application/json", :json, ["application/vnd.contentful.management.v1+json"]
    end

    config.to_prepare do
      if defined?(::ContentfulModel)
        ContentfulModel::Base.send(:include, ContentfulRails::CachedTimestamps)
      end
    end

    #if we're at the end of initialization and there's no config object,
    #set one up with the default options (i.e. an empty proc)
    config.after_initialize do
      if ContentfulRails.configuration.nil?
        ContentfulRails.configure {}
      end
    end
  end
end<commit_msg>Remove re-specification of the JSON mime type. We force to JSON in the request to the webhooks endpoint, which is all we need<commit_after>module ContentfulRails
  class Engine < ::Rails::Engine

    isolate_namespace ContentfulRails

    #Iterate through all models which inherit from ContentfulModel::Base
    #and add an entry mapping for them, so calls to the Contentful API return
    #the appropriate classes.
    initializer "add_entry_mappings_for_contentful_models" do
      if defined?(ContentfulModel)
        Rails.application.eager_load!
        ContentfulModel::Base.descendents.each do |klass|
          klass.send(:add_entry_mapping)
        end
      end
    end

    config.to_prepare do
      if defined?(::ContentfulModel)
        ContentfulModel::Base.send(:include, ContentfulRails::CachedTimestamps)
      end
    end

    #if we're at the end of initialization and there's no config object,
    #set one up with the default options (i.e. an empty proc)
    config.after_initialize do
      if ContentfulRails.configuration.nil?
        ContentfulRails.configure {}
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.06628621597892889, 'fraction_numerical': 0.0004389815627743635, 'mean_word_length': 3.2360594795539033, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '337631', 'n_tokens_mistral': 650, 'n_tokens_neox': 643, 'n_words': 199}