class Algebra::Complement

Attributes

values[R]

Public Class Methods

new(values) click to toggle source
# File bin/twitter-algebra, line 127
def initialize(values)
  @values = values.uniq
end

Public Instance Methods

&(other) click to toggle source
# File bin/twitter-algebra, line 131
def &(other)
  if other.is_a?(Complement)
    Complement.new(values | other.values)
  else
    Complement.new(other.values - values)
  end
end
|(other) click to toggle source
# File bin/twitter-algebra, line 139
def |(other)
  if other.is_a?(Complement)
    Complement.new(values & other.values)
  else
    Complement.new(values - other.values)
  end
end
~() click to toggle source
# File bin/twitter-algebra, line 147
def ~
  Set.new(values)
end