<commit_before>module DataMapper
  class Engine
    module Arel

      # Engine for Arel
      #
      class Engine < DataMapper::Engine
        attr_reader :adapter

        attr_reader :arel_engine_class

        attr_reader :arel_engines

        # @api private
        def initialize(uri, arel_engine_class = ActiveRecord::Base)
          super(Addressable::URI.parse(uri))
          @arel_engine_class = arel_engine_class
          establish_connection
          reset_engines!
        end

        # @api private
        def relation_node_class
          Node
        end

        # @api private
        def relation_edge_class
          Edge
        end

        # @api private
        def base_relation(name, header)
          ::Arel::Table.new(name, arel_engine_for(name, header))
        end

        # @api private
        def gateway_relation(relation)
          Gateway.new(self, relation)
        end

        # @api private
        def reset_engines!
          @arel_engines = {}
        end

        private

        # @api private
        def establish_connection
          arel_engine_class.establish_connection(
            :adapter  => uri.scheme,
            :database => uri.path.sub(/^\//, ''),
            :username => uri.user,
            :password => <PASSWORD>
          )
        end

        # @api private
        def arel_engine_for(name, header)
          # TODO: this is temporary. we need to find out how to create a thin arel engine
          arel_engines.fetch(name) {
            arel_engines[name] = Class.new(arel_engine_class) { self.table_name = name }
          }
        end

      end # class Engine
    end # module Arel
  end # class Engine
end # module DataMapper
<commit_msg>Move Arel::Engine#reset_engines! below private methods<commit_after>module DataMapper
  class Engine
    module Arel

      # Engine for Arel
      #
      class Engine < DataMapper::Engine
        attr_reader :adapter

        attr_reader :arel_engine_class

        attr_reader :arel_engines

        # @api private
        def initialize(uri, arel_engine_class = ActiveRecord::Base)
          super(Addressable::URI.parse(uri))
          @arel_engine_class = arel_engine_class
          establish_connection
          reset_engines!
        end

        # @api private
        def relation_node_class
          Node
        end

        # @api private
        def relation_edge_class
          Edge
        end

        # @api private
        def base_relation(name, header)
          ::Arel::Table.new(name, arel_engine_for(name, header))
        end

        # @api private
        def gateway_relation(relation)
          Gateway.new(self, relation)
        end

        private

        # @api private
        def reset_engines!
          @arel_engines = {}
        end

        # @api private
        def establish_connection
          arel_engine_class.establish_connection(
            :adapter  => uri.scheme,
            :database => uri.path.sub(/^\//, ''),
            :username => uri.user,
            :password => <PASSWORD>
          )
        end

        # @api private
        def arel_engine_for(name, header)
          # TODO: this is temporary. we need to find out how to create a thin arel engine
          arel_engines.fetch(name) {
            arel_engines[name] = Class.new(arel_engine_class) { self.table_name = name }
          }
        end

      end # class Engine
    end # module Arel
  end # class Engine
end # module DataMapper

{'fraction_non_alphanumeric': 0.07394668959587274, 'fraction_numerical': 0.0, 'mean_word_length': 1.715953307392996, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '6944104', 'n_tokens_mistral': 980, 'n_tokens_neox': 943, 'n_words': 240}