Module: Mixture

Defined in:
lib/mixture.rb,
lib/mixture/model.rb,
lib/mixture/types.rb,
lib/mixture/coerce.rb,
lib/mixture/errors.rb,
lib/mixture/version.rb,
lib/mixture/validate.rb,
lib/mixture/attribute.rb,
lib/mixture/types/nil.rb,
lib/mixture/types/set.rb,
lib/mixture/coerce/nil.rb,
lib/mixture/coerce/set.rb,
lib/mixture/extensions.rb,
lib/mixture/types/date.rb,
lib/mixture/types/hash.rb,
lib/mixture/types/time.rb,
lib/mixture/types/type.rb,
lib/mixture/coerce/base.rb,
lib/mixture/coerce/date.rb,
lib/mixture/coerce/hash.rb,
lib/mixture/coerce/time.rb,
lib/mixture/types/array.rb,
lib/mixture/types/class.rb,
lib/mixture/types/float.rb,
lib/mixture/types/range.rb,
lib/mixture/coerce/array.rb,
lib/mixture/coerce/class.rb,
lib/mixture/coerce/float.rb,
lib/mixture/coerce/range.rb,
lib/mixture/types/access.rb,
lib/mixture/types/object.rb,
lib/mixture/types/string.rb,
lib/mixture/types/symbol.rb,
lib/mixture/coerce/object.rb,
lib/mixture/coerce/string.rb,
lib/mixture/coerce/symbol.rb,
lib/mixture/types/boolean.rb,
lib/mixture/types/integer.rb,
lib/mixture/types/numeric.rb,
lib/mixture/validate/base.rb,
lib/mixture/attribute_list.rb,
lib/mixture/coerce/boolean.rb,
lib/mixture/coerce/integer.rb,
lib/mixture/types/datetime.rb,
lib/mixture/types/rational.rb,
lib/mixture/validate/match.rb,
lib/mixture/coerce/datetime.rb,
lib/mixture/coerce/rational.rb,
lib/mixture/validate/length.rb,
lib/mixture/types/collection.rb,
lib/mixture/types/enumerable.rb,
lib/mixture/validate/presence.rb,
lib/mixture/validate/exclusion.rb,
lib/mixture/validate/inclusion.rb,
lib/mixture/extensions/hashable.rb,
lib/mixture/extensions/coercable.rb,
lib/mixture/extensions/validatable.rb,
lib/mixture/extensions/attributable.rb

Overview

The mixture module.

Defined Under Namespace

Modules: Coerce, Extensions, Model, Types, Validate Classes: Attribute, AttributeList, BasicError, CoercionError, ValidationError

Constant Summary collapse

Undefined =

An undefined value. This is used in place so that we can be sure that an argument wasn't passed.

Examples:

As a placeholder.

def self.constraint(value = Undefined, &block)
  if value != Undefined
    constraints << value
  elsif block_given?
    constraints << block
  else
    raise ArgumentError, "Expected an argument or block"
  end
end

Returns:

  • (Object)
Object.new.freeze
Itself =

A proc that returns its first argument.

Returns:

  • (Proc{(Object) => Object})
proc { |value| value }
Prove =

A proc that returns true.

Returns:

  • (Proc{() => true})
proc { true }
Refute =

A proc that returns false.

Returns:

  • (Proc{() => false})
proc { false }
VERSION =

The current version of Mixture.

Returns:

  • (String)
"0.7.0"

Class Method Summary collapse

Class Method Details

.finalizevoid

This method returns an undefined value.

Finalizes all of the Mixture modules.



44
45
46
47
48
# File 'lib/mixture.rb', line 44

def self.finalize
  Mixture::Coerce.finalize
  Mixture::Extensions.finalize
  nil
end