Class: KeySet::All
Constant Summary
Constants inherited from KeySet
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from KeySet
#<=>, #==, #===, all, all_except_some, default_logger, #eql?, #hash, logger, none, #represents_none?, some
Class Method Details
.class_sort_index ⇒ Object
5 6 7 |
# File 'lib/key_set/all.rb', line 5 def self.class_sort_index 3 end |
Instance Method Details
#intersect(other) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/key_set/all.rb', line 37 def intersect(other) case other when All KeySet.all when None KeySet.none when Some KeySet.some other.keys when AllExceptSome KeySet.all_except_some other.keys else raise ArgumentError, 'it needs a valid KeySet' end end |
#remove(other) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/key_set/all.rb', line 17 def remove(other) case other when All # we have everything, we remove everything => we have nothing KeySet.none when None # we have everything, we remove nothing => we have everything KeySet.all when Some # we have everything, we remove some => we have all except those KeySet.all_except_some other.keys when AllExceptSome # we have everything, we remove all except some => we have only those KeySet.logger.warn "KeySet removing AllButSome, probably a mistake. this: ALL, removing keys: #{other.keys.inspect}" KeySet.some other.keys else raise ArgumentError, 'it needs a valid KeySet' end end |
#represents_all? ⇒ Boolean
9 10 11 |
# File 'lib/key_set/all.rb', line 9 def represents_all? true end |