Logo: Relish

  1. Sign in

Project: Contracts-ruby

Builtin contracts

To use builtin contracts you can refer them with Contracts::*:

Contract Contracts::Num => Contracts::Maybe(Contracts::Num)

It is recommended to use a short alias for Contracts, for example C:

C = Contracts

Contract C::Num => C::Maybe(C::Num)

It is possible to include Contracts and refer them without namespace, but
this is deprecated and not recommended.

NOTE: in the future it will be possible to do include Contracts::Builtin

NOTE: all contracts marked as (TODO) have their documentaion .feature file
as stub. Contributions to those are warmly welcome!


  1. And
  2. Any
  3. Args
  4. ArrayOf (TODO)
  5. Bool
  6. Enum (TODO)
  7. Eq (TODO)
  8. Exactly (TODO)
  9. Func (TODO)
  10. HashOf (TODO)
  11. Int
  12. KeywordArgs (TODO)
  13. Maybe (TODO)
  14. Nat
  15. NatPos
  16. Neg
  17. None
  18. Not (TODO)
  19. Num
  20. Or
  21. Pos
  22. RangeOf (TODO)
  23. RespondTo
  24. Send
  25. SetOf (TODO)
  26. Xor

Last published almost 5 years ago by waterlink.