Sha256: 76376576638394337cb2af9d42aaffcaafa7fee7053fa8e0bafcbfde7511d856

Contents?: true

Size: 962 Bytes

Versions: 4

Compression:

Stored size: 962 Bytes

Contents

# encoding: utf-8

module Veritas
  class Attribute

    # Represents a Boolean value in a relation tuple
    class Boolean < Object
      include Function::Connective::Conjunction::Methods,
              Function::Connective::Disjunction::Methods,
              Function::Connective::Negation::Methods

      # The Boolean primitive
      #
      # @example
      #   Boolean.primitive  # => TrueClass
      #
      # @return [Class<TrueClass>]
      #
      # @api public
      def self.primitive
        TrueClass
      end

      # Test if the value is a boolean
      #
      # @example
      #   boolean.valid_value?(value)  # => true or false
      #
      # @param [Object] value
      #   the value to test
      #
      # @return [Boolean]
      #
      # @api public
      def valid_value?(value)
        valid_or_optional?(value) { super || value.kind_of?(FalseClass) }
      end

    end # class Boolean
  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/boolean.rb
veritas-0.0.6 lib/veritas/attribute/boolean.rb
veritas-0.0.5 lib/veritas/attribute/boolean.rb
veritas-0.0.4 lib/veritas/attribute/boolean.rb