Sha256: 3ab0188a4f4903d46e58ccd2b32e4122b1c864cc52ce0768ce8a4c4e9d69ee77

Contents?: true

Size: 937 Bytes

Versions: 3

Compression:

Stored size: 937 Bytes

Contents

module Veritas
  class Attribute

    # A mixin for attributes that have comparable values
    module Comparable
      include Orderable,
              Logic::Predicate::GreaterThan::Methods,
              Logic::Predicate::GreaterThanOrEqualTo::Methods,
              Logic::Predicate::LessThan::Methods,
              Logic::Predicate::LessThanOrEqualTo::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

3 entries across 3 versions & 1 rubygems

Version Path
veritas-0.0.3 lib/veritas/attribute/comparable.rb
veritas-0.0.2 lib/veritas/attribute/comparable.rb
veritas-0.0.1 lib/veritas/attribute/comparable.rb