lib/veritas/aggregate.rb in veritas-0.0.5 vs lib/veritas/aggregate.rb in veritas-0.0.6

- old
+ new

@@ -2,12 +2,15 @@ module Veritas # Abstract class for aggregate functions class Aggregate + extend Comparator include AbstractClass, Immutable, Visitable, Operation::Unary + compare :operand + # Return the default accumulator # # @example # default = Aggregate.default # @@ -92,9 +95,24 @@ # @return [Class<Attribute>] # # @api public def type raise NotImplementedError, "#{self.class}#type must be implemented" + end + + # Compare the aggregate with other aggregate for equivalency + # + # @example + # aggregate == other # => true or false + # + # @param [Aggregate] other + # the other aggregate to compare with + # + # @return [Boolean] + # + # @api public + def ==(other) + cmp?(__method__, other) end private # Extract the value from the operand or tuple