module Ransack::Adapters::Mongoid::Attributes::Predications

Public Instance Methods

does_not_match(other) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 66
def does_not_match(other)
  { "$not" => { name => /#{other}/i } }.to_inquiry
end
does_not_match_all(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 74
def does_not_match_all(others)
  grouping_all :does_not_match, others
end
does_not_match_any(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 70
def does_not_match_any(others)
  grouping_any :does_not_match, others
end
eq(other) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 18
def eq(other)
  { name => other }.to_inquiry
end
eq_all(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 26
def eq_all(others)
  grouping_all :eq, others
end
eq_any(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 22
def eq_any(others)
  grouping_any :eq, others
end
gt(right) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 90
def gt(right)
  { name => { '$gt' => right } }.to_inquiry
end
gt_all(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 98
def gt_all(others)
  grouping_all :gt, others
end
gt_any(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 94
def gt_any(others)
  grouping_any :gt, others
end
gteq(right) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 78
def gteq(right)
  { name => { '$gte' => right } }.to_inquiry
end
gteq_all(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 86
def gteq_all(others)
  grouping_all :gteq, others
end
gteq_any(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 82
def gteq_any(others)
  grouping_any :gteq, others
end
in(other) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 30
def in(other)
  { name => { "$in" => other } }.to_inquiry
end
in_all(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 38
def in_all(others)
  grouping_all :in, others
end
in_any(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 34
def in_any(others)
  grouping_any :in, others
end
lt(right) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 102
def lt(right)
  { name => { '$lt' => right } }.to_inquiry
end
lt_all(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 110
def lt_all(others)
  grouping_all :lt, others
end
lt_any(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 106
def lt_any(others)
  grouping_any :lt, others
end
lteq(right) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 114
def lteq(right)
  { name => { '$lte' => right } }.to_inquiry
end
lteq_all(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 122
def lteq_all(others)
  grouping_all :lteq, others
end
lteq_any(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 118
def lteq_any(others)
  grouping_any :lteq, others
end
matches(other) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 54
def matches(other)
  { name => /#{other}/i }.to_inquiry
end
matches_all(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 62
def matches_all(others)
  grouping_all :matches, others
end
matches_any(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 58
def matches_any(others)
  grouping_any :matches, others
end
not_eq(other) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 6
def not_eq(other)
  { name => { '$ne' => other } }.to_inquiry
end
not_eq_all(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 14
def not_eq_all(others)
  grouping_all :not_eq, others
end
not_eq_any(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 10
def not_eq_any(others)
  grouping_any :not_eq, others
end
not_in(other) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 42
def not_in(other)
  { "$not" => { name => { "$in" => other } } }.to_inquiry
end
not_in_all(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 50
def not_in_all(others)
  grouping_all :not_in, others
end
not_in_any(others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 46
def not_in_any(others)
  grouping_any :not_in, others
end

Private Instance Methods

grouping_all(method_id, others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 133
def grouping_all(method_id, others)
  nodes = others.map { |e| send(method_id, e) }
  { "$and" => nodes }.to_inquiry
end
grouping_any(method_id, others) click to toggle source
# File lib/ransack/adapters/mongoid/attributes/predications.rb, line 128
def grouping_any(method_id, others)
  nodes = others.map { |e| send(method_id, e) }
  { "$or" => nodes }.to_inquiry
end