class KeySet::All

Public Class Methods

class_sort_index() click to toggle source
# File lib/key_set/all.rb, line 5
def self.class_sort_index
  3
end

Public Instance Methods

intersect(other) click to toggle source
# 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
invert() click to toggle source
# File lib/key_set/all.rb, line 13
def invert
  KeySet.none
end
remove(other) click to toggle source
# 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?() click to toggle source
# File lib/key_set/all.rb, line 9
def represents_all?
  true
end