Sha256: 8e987d8749555a3fcabfe09c26a239727f0a6b344f930b447d30ec3112cba80e

Contents?: true

Size: 744 Bytes

Versions: 2

Compression:

Stored size: 744 Bytes

Contents

module Season
  class QueryBuilder

    def initialize(adapter_class_name)
      @adapter_class_name = adapter_class_name
    end

    def build(table_name, column_name, query_verb)
      self.send("#{@adapter_class_name}_#{query_verb}", table_name, column_name)
    end

    private

      def active_record_before(table_name, column_name)
        "where(" + "\"#{table_name}.#{column_name} < ?\"" + ", *args)"
      end

      def active_record_between(table_name, column_name)
        "where(" + "\"#{table_name}.#{column_name} > ? AND #{table_name}.#{column_name} < ?\"" + ", *args)"
      end

      def active_record_after(table_name, column_name)
        "where(" + "\"#{table_name}.#{column_name} > ?\"" + ", *args)"
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
season-0.3 lib/season/query_builder.rb
season-0.2 lib/season/query_builder.rb