Class: KeySet::AllExceptSome
Constant Summary
Constants inherited
from KeySet
VERSION
Class Method Summary
collapse
Instance Method Summary
collapse
#clone, #keys_array, #represents_all?, #represents_none?
Methods inherited from KeySet
#<=>, #==, #===, all, all_except_some, default_logger, #eql?, #hash, logger, none, #represents_all?, #represents_none?, some
Class Method Details
.class_sort_index ⇒ Object
7
8
9
|
# File 'lib/key_set/all_except_some.rb', line 7
def self.class_sort_index
2
end
|
Instance Method Details
#intersect(other) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/key_set/all_except_some.rb', line 35
def intersect(other)
case other
when All
KeySet.all_except_some keys.deep_dup
when None
KeySet.none
when Some
intersect_some(other)
when AllExceptSome
intersect_all_except_some(other)
else
raise ArgumentError, 'it needs a valid KeySet'
end
end
|
#invert ⇒ Object
11
12
13
|
# File 'lib/key_set/all_except_some.rb', line 11
def invert
KeySet.some(keys_array)
end
|
#remove(other) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/key_set/all_except_some.rb', line 15
def remove(other)
case other
when All
KeySet.none
when None
KeySet.all_except_some keys.deep_dup
when Some
remove_some(other)
when AllExceptSome
KeySet.logger.warn "KeySet removing AllButSome, probably a mistake. this: ALL_BUT_SOME, removing keys: #{other.keys.inspect}"
remove_all_except_some(other)
else
raise ArgumentError, 'it needs a valid KeySet'
end
end
|