Module: Babik::QuerySet::Condition
- Defined in:
- lib/babik/queryset/lib/condition.rb
Overview
Each one of the conditions that can appear in a SQL WHERE.
Defined Under Namespace
Classes: Conjunction
Class Method Summary collapse
-
.factory(model, filter) ⇒ Object
Return the Disjunction or Conjunction according to what class the filters parameter is.
Class Method Details
.factory(model, filter) ⇒ Object
Return the Disjunction or Conjunction according to what class the filters parameter is.
13 14 15 16 17 18 19 20 21 |
# File 'lib/babik/queryset/lib/condition.rb', line 13 def self.factory(model, filter) if filter.class == Array return Disjunction.new(model, filter.map { |filter_i| Conjunction.new(model, filter_i) }) end if filter.class == Hash return Conjunction.new(model, filter) end raise '`filter\' parameter must be an Array for OR-based AND-conditions or a hash for a lone AND-condition' end |