v0.17.2 - 2024-10-06
- Bugfix: Fix pattern matching - PikachuEXE #308
v0.17.1 - 2024-10-06
- Bugfix: Fix keyword arguments contract when used with optional positional arguments - PikachuEXE #305
- Enhancement: Always load version.rb, suppress legacy deprecation warning - Vlad Pisanov #301
- Enhancement: Update doc & spec about deprecated
Fixnum
toInteger
- PikachuEXE #301
v0.17 - 2021-09-28
- Update implementation & spec to be 3.0 compatible Support for Ruby 2 has been discontinued - PikachuEXE #295
v0.16.1 - 2021-04-17
- Enhancement: Pretty-print contracts in error messages - Corey Farwell #289
- Bugfix: Fix
attr_accessor_with_contract
with multiple attribute names input - Kevin Yeh #259 - Bugfix: Fix "stack level too deep" in CI builds - md-work #283
v0.16.0 - 2017-04-24
- Support for Ruby 1.8 has been discontinued - Corey Farwell #256
- Enhancement: Add a
Contracts::Attrs
module containing attribute w/ contracts utilities - Corey Farwell #255 - Bugfix: Fix StrictHash contract for extra keys - Maciej Malecki #254
v0.15.0 - 2017-02-24
- Bugfix: Func contract's return value isn't enforced with blocks - Piotr Szmielew #251
- Bugfix: Fix contracts used in AR-models - Gert Goet #237
v0.14.0 - 2016-04-26
- Enhancement: Add StrictHash contract - Fyodor #236
- Bugfix: dont fail if something other than a hash is passed to a KeywordArgs - Dan Padilha #234
- LICENSE ADDED: Simplified BSD (same as what is specified in the readme) - Charles Dale #233
- Bugfix: fix constant looking when including a module that includes contracts (requires removing the check to see if contracts is already included) - Aditya Bhargava #232
- Bugfix for err case when KeywordArgs and Proc are used together - Aditya Bhargava #230
- Enhancement: Add DescendantOf contract - Miguel Palhas #227
v0.13.0 - 2016-01-25
- Enhancement: Add support for Ruby 2.3 - Oleksii Fedorov #216
- Enhancement: Added Int, Nat and NatPos builtin contracts - Simon George #212
- Bugfix: Allow contracts on singleton of subclass - Oleksii Federov #211
v0.12.0 - 2015-09-15
- Feature: add
Regexp
validator - Gert Goet #196 - Docs: bootstrap cucumber/aruba/relish setup - Oleksii Fedorov #195
- Bugfix: allow to
extend
module, that hasContracts
orContracts::Core
included without harming current module/classContracts
functionality, see: #176 - Oleksii Fedorov #198 - Enhancement: add
include Contracts::Builtin
to allow users to use builtin contracts withoutContracts::
prefix together withinclude Contracts::Core
- PikachuEXE #199
v0.11.0 - 2015-07-30
- Enhancement: add
include Contracts::Core
that doesn't pollute the namespace as much asinclude Contracts
- Oleksii Federov #185 - Bugfix: fail if a non-hash is provided to a
HashOf
contract - Abe Voelker #190 - Bugfix: bugfix for using varargs and
Maybe[Proc]
together - Adit Bhargava #188 - Bugfix: make KeywordArgs fail if unexpected keys are passed in - Abe Voelker #187
- Feature: range contract added - Oleksii Fedorov #184
- Feature: enum contract added - Dennis Günnewig #181
v0.10.1 - 2015-07-16
- Enhancement: make
@pattern_match
instance variable not render ruby warning. Required to use new aruba versions in rspec tests - Dennis Günnewig #179
v0.10 - 2015-07-07
- Bugfix: make
Maybe[Proc]
work correctly - Simon George #142 - Bugfix: make
Func
contract verified when used as return contract - Rob Rosenbaum #145 - Bugfix: make
Pos
,Neg
andNat
contracts handle non-numeric values correctly - Matt Griffin and Gavin Sinclair #147 #173 - Enhancement: reduce user class pollution through introduction of contracts engine - Oleksii Fedorov #141
- Feature: add builtin
KeywordArgs
andOptional
contracts for keyword arguments handling - Oleksii Fedorov #151 - Feature: recognize module as a class contract - Oleksii Fedorov #153
- Feature: custom validators with
Contract.override_validator
- Oleksii Fedorov #159 - Feature: add builtin
RangeOf[...]
contract - Gavin Sinclair #171
v0.9 - 2015-04-24
-
MAJOR fix in pattern-matching: If the return contract for a pattern-matched function fails, it should NOT try the next pattern-match function. Pattern-matching is only for params, not return values.
-
raise an error if multiple defns have the same contract for pattern matching.
-
New syntax for functions with no input params (the old style still works) Old way:
Contract nil => 1 def one
New way:
Contract 1 def one
-
Prettier HashOf contract can now be written like this:
HashOf[Num => String]
-
Add
SetOf
contract -
various small fixes
- code refactored (very slight loss of performance, big increase in readability)
- fail when defining a contract on a module without
include Contracts::Modules
- fixed several bugs in argument parsing, functions with complex params get contracts applied correctly now.
- added rubocop to ci.
- if a contract is set on a protected method, it should not become public.
- fixed pattern matching when the multiple definitions of functions have different arities.
- couple of new built-in contracts: Nat, Eq.
- changed
Invariant
toinvariant
:invariant(:day) { 1 <= day && day <= 31 }
- prettier error messages (
Contracts::Num
is now justNum
, for example) - support for yard-contracts