Sha256: abf037859ee7b36af991186b85213f1040d5de810cc4d1468cedc9c1a9e2ba20

Contents?: true

Size: 461 Bytes

Versions: 1

Compression:

Stored size: 461 Bytes

Contents

module Thebes::Sphinxql
  
  class Query

    def initialize query
      @query = query
      @client = Client.new
    end

    def run
      @client.query self.to_sql
    end

    def to_sql
      case @query
      when String
        @query
      when Array
        @query.shift % (@query.collect { |q|
          @client.escape(q)
        })
      end
    end

    class << self

      def run query
        self.new(query).run
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thebes-0.0.3 lib/thebes/sphinxql/query.rb