Sha256: da10ed6a04800fadafafd0d8907eb97feca53b9d863bc1422beb1ea407f96de7

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

# encoding: utf-8

module Veritas
  class Attribute

    # A mixin for attributes that have comparable values
    module Comparable
      include Orderable,
              Function::Predicate::GreaterThan::Methods,
              Function::Predicate::GreaterThanOrEqualTo::Methods,
              Function::Predicate::LessThan::Methods,
              Function::Predicate::LessThanOrEqualTo::Methods,
              Aggregate::Minimum::Methods,
              Aggregate::Maximum::Methods,
              Aggregate::Mean::Methods,
              Aggregate::Variance::Methods,
              Aggregate::StandardDeviation::Methods

      # Compare the attribute with other attribute to see if they are of the same type
      #
      # @example
      #   attribute.comparable?(other)  # => true or false
      #
      # @param [Attribute] other
      #   the other attribute to compare with
      #
      # @return [Boolean]
      #
      # @todo figure out how to dry this up with Attribute#joinable?
      #
      # @api public
      def comparable?(other)
        kind_of?(other.class) || other.kind_of?(self.class)
      end

    end # module Comparable
  end # class Attribute
end # module Veritas

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
veritas-0.0.7 lib/veritas/attribute/comparable.rb
veritas-0.0.6 lib/veritas/attribute/comparable.rb
veritas-0.0.5 lib/veritas/attribute/comparable.rb
veritas-0.0.4 lib/veritas/attribute/comparable.rb