Sha256: 068ae95b69b06559b3998c00578b1ba5c117a82a069c1bac2a2cb2a91c37c6a9

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

module CassandraObject
  class Scope
    module QueryMethods

      def cql_response
        cloned = self.clone
        cloned.raw_response = true
        cloned
      end

      def columns
        cloned = self.clone
        cloned.select_values = [:column1]
        cloned.cql_response
      end

      def select!(*values)
        self.select_values += values.flatten
        self
      end

      def select(*values, &block)
        if block_given?
          to_a.select(&block)
        else
          clone.select!(*values)
        end
      end

      def where!(*values)
        if values.flatten.size == 1
          self.where_values += values.flatten
          self.where_values << ''
        else
          self.where_values += values.flatten
        end
        self
      end

      def where(*values)
        clone.where! values
      end

      def where_ids!(*ids)
        self.id_values += ids.flatten
        self.id_values.compact if self.id_values.present?
        self
      end

      def where_ids(*ids)
        clone.where_ids! ids
      end

      def limit!(value)
        self.limit_value = value
        self
      end

      def limit(value)
        clone.limit! value
      end

      def to_a
        select_records
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
extendi-cassandra_object-1.0.5 lib/cassandra_object/scope/query_methods.rb
extendi-cassandra_object-1.0.4 lib/cassandra_object/scope/query_methods.rb
extendi-cassandra_object-1.0.1 lib/cassandra_object/scope/query_methods.rb
extendi-cassandra_object-1.0.0 lib/cassandra_object/scope/query_methods.rb