Sha256: 9c45fa93515ee7c822d066166efe80496fd96db99f03ac132bdcee04cdba712e

Contents?: true

Size: 800 Bytes

Versions: 33

Compression:

Stored size: 800 Bytes

Contents

class Card
  class Query
    module Conjunctions
      def all val
        conjoin val, :and
      end
      alias and all

      def any val
        conjoin val, :or
      end
      alias or any
      alias in any

      def conjoin val, conj
        sq = subquery unjoined: true, conj: conj
        unless val.is_a? Array
          val = clause_to_hash(val).map { |key, value| { key => value } }
        end
        val.each do |val_item|
          sq.interpret val_item
        end
      end

      def not val
        notjoin = join_cards val, conditions_on_join: true, side: "LEFT"
        add_condition "#{notjoin.table_alias}.id is null"
      end

      def conjunction val
        return unless [String, Symbol].member? val.class
        CONJUNCTIONS[val.to_sym]
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
card-1.94.1 lib/card/query/conjunctions.rb
card-1.94.0 lib/card/query/conjunctions.rb
card-1.93.13 lib/card/query/conjunctions.rb
card-1.93.12 lib/card/query/conjunctions.rb
card-1.93.11 lib/card/query/conjunctions.rb
card-1.93.10 lib/card/query/conjunctions.rb
card-1.93.9 lib/card/query/conjunctions.rb
card-1.93.8 lib/card/query/conjunctions.rb
card-1.93.7 lib/card/query/conjunctions.rb
card-1.93.6 lib/card/query/conjunctions.rb
card-1.93.5 lib/card/query/conjunctions.rb
card-1.93.4 lib/card/query/conjunctions.rb
card-1.93.3 lib/card/query/conjunctions.rb
card-1.93.2 lib/card/query/conjunctions.rb
card-1.93.1 lib/card/query/conjunctions.rb
card-1.93.0 lib/card/query/conjunctions.rb
card-1.92.2 lib/card/query/conjunctions.rb
card-1.92.1 lib/card/query/conjunctions.rb
card-1.92 lib/card/query/conjunctions.rb
card-1.91 lib/card/query/conjunctions.rb