Sha256: 8fa437ae0b967ba034af00f26343dbd371aed19a7a11f2cc6586bb9b95c789b4

Contents?: true

Size: 829 Bytes

Versions: 2

Compression:

Stored size: 829 Bytes

Contents

module Superstore
  class Scope
    module QueryMethods
      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)
        self.where_values += values.flatten
        self
      end

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

      def where_ids!(*ids)
        self.id_values += ids.flatten
        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

2 entries across 2 versions & 1 rubygems

Version Path
superstore-1.0.2 lib/superstore/scope/query_methods.rb
superstore-1.0.0 lib/superstore/scope/query_methods.rb