Sha256: 883e99403c65601b8c1ef3705c0b21110ed8b6b6d4be1b33fe8d7c89d58ea1dc

Contents?: true

Size: 575 Bytes

Versions: 31

Compression:

Stored size: 575 Bytes

Contents

require "directive_record/query/sql"
require "directive_record/query/mysql"
require "directive_record/query/big_query"

module DirectiveRecord
  module Query

    def self.new(klass, connection = nil)
      class_for((connection || klass.connection).class.name.downcase).new(klass)
    end

  private

    def self.class_for(connection_class)
      if connection_class.include?("mysql")
        MySQL
      elsif connection_class.include?("bigquery")
        BigQuery
      else
        raise NotImplementedError, "Connection type not supported"
      end
    end

  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
directiverecord-0.1.12 lib/directive_record/query.rb
directiverecord-0.1.11 lib/directive_record/query.rb
directiverecord-0.1.10 lib/directive_record/query.rb
directiverecord-0.1.9 lib/directive_record/query.rb
directiverecord-0.1.8 lib/directive_record/query.rb
directiverecord-0.1.7 lib/directive_record/query.rb
directiverecord-0.1.6 lib/directive_record/query.rb
directiverecord-0.1.5 lib/directive_record/query.rb
directiverecord-0.1.4 lib/directive_record/query.rb
directiverecord-0.1.3 lib/directive_record/query.rb
directiverecord-0.1.2 lib/directive_record/query.rb