module SimpleContracts
Base
class for writting contracts. the only public method is SimpleContracts::Base#call
(or alias SimpleContracts::Base#match!
)
The purpose is to validate some action against your expectations. There are 2 kind of them:
-
Guarantee - state that SHOULD be recognized for after every the actions
-
Expectation - state that COULD be recognized after the action
The key behavior is:
-
First verify that all Guarantees are met, then
-
Then move to Expectation and verify that at least one of them met.
-
If any of those checks fail - we should recieve detailed exception - why.
There are 2 kind of exceptions:
-
GuaranteeError - happens if one of the Guarantees failes
-
ExpectationsError
- happens if none of Expextations were meet.
Both of them raise with the @meta object, which contains extra debugging info.
Constants
- VERSION