Sha256: 49c270c7a60101196d7730818da4ac4865eae26c73b91e5ab4ca793597e2d7c6
Contents?: true
Size: 840 Bytes
Versions: 4
Compression:
Stored size: 840 Bytes
Contents
class ModelSet module Conditioned # Shared methods for dealing with conditions. attr_accessor :conditions def add_conditions!(*conditions) new_conditions = conditions.first.kind_of?(Symbol) ? [conditions.shift] : [] conditions.each do |condition| if condition.kind_of?(Conditions) new_conditions << condition else new_conditions.concat([*transform_condition(condition)]) end end return self if new_conditions.empty? @conditions = to_conditions(*new_conditions) << @conditions clear_cache! end def to_conditions(*conditions) Conditions.new(conditions, condition_ops) end def invert! raise 'cannot invert without conditions' if @conditions.nil? @conditions = ~@conditions clear_cache! end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
model_set-1.1.3 | lib/model_set/conditioned.rb |
model_set-1.1.2 | lib/model_set/conditioned.rb |
model_set-1.1.1 | lib/model_set/conditioned.rb |
model_set-1.1.0 | lib/model_set/conditioned.rb |