<commit_before>require 'rails/generators/base'

module PgSearch
  module Migration
    class Generator < Rails::Generators::Base
      hide!

      def self.inherited(subclass)
        super
        subclass.source_root File.expand_path('../templates', __FILE__)
      end

      def create_migration
        now = Time.now.utc
        filename = "#{now.strftime('%Y%m%d%H%M%S')}_#{migration_name}.rb"
        template "#{migration_name}.rb.erb", "db/migrate/#{filename}"
      end

      private

      def read_sql_file(filename)
        sql_directory = File.expand_path('../../../../sql', __FILE__)
        source_path = File.join(sql_directory, "#{filename}.sql")
        File.read(source_path).strip
      end
    end
  end
end
<commit_msg>Fix Generator's compatibility with Rails 3.x<commit_after>require 'rails/generators/base'

module PgSearch
  module Migration
    class Generator < Rails::Generators::Base
      Rails::Generators.hide_namespace namespace

      def self.inherited(subclass)
        super
        subclass.source_root File.expand_path('../templates', __FILE__)
      end

      def create_migration
        now = Time.now.utc
        filename = "#{now.strftime('%Y%m%d%H%M%S')}_#{migration_name}.rb"
        template "#{migration_name}.rb.erb", "db/migrate/#{filename}"
      end

      private

      def read_sql_file(filename)
        sql_directory = File.expand_path('../../../../sql', __FILE__)
        source_path = File.join(sql_directory, "#{filename}.sql")
        File.read(source_path).strip
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.13222079589216945, 'fraction_numerical': 0.0006418485237483953, 'mean_word_length': 2.6682352941176473, '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': '7303155', 'n_tokens_mistral': 503, 'n_tokens_neox': 487, 'n_words': 88}