- Breaking Change: compatibility shifted to > Ruby 2.1
- Refactoring: CallWith module is now more comprehensible
- Enhancement: Badges: Codeclimate / Code coverage
- Enhancement: more Rubocop cops enabled
- Enhancement: extract Contract class to contracts/contract.rb
- Enhancement: extract FailureCallback module to contracts/contract/failure_callback.rb
- Enhancement: better ErrorFormatter for KeywordArgs contract
- Enhancement: many loops / conditional branches / old comments are improved / simplified
- Enhancement: rename Contracts::Args -> C::SplatArgs for clearer intention (with deprecation warning)
- Enhancement: remove Cucumber tests, because they are slow and inflexible
- Enhancement: Rspec helper cleanup
- Enhancement: Rspec tests with much less noise / no warnings
- Code Diff:
git diff 8889f13..03e9c56 - https://github.com/ddd-ruby/contracts.ruby/compare/8889f13...03e9c56
- 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
- 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
- Feature: add
Regexpvalidator - Gert Goet #196 - Docs: bootstrap cucumber/aruba/relish setup - Oleksii Fedorov #195
- Bugfix: allow to
extendmodule, that hasContractsorContracts::Coreincluded without harming current module/classContractsfunctionality, see: #176 - Oleksii Fedorov #198 - Enhancement: add
include Contracts::Builtinto allow users to use builtin contracts withoutContracts::prefix together withinclude Contracts::Core- PikachuEXE #199
- Enhancement: add
include Contracts::Corethat doesn't pollute the namespace as much asinclude Contracts- Oleksii Federov #185 - Bugfix: fail if a non-hash is provided to a
HashOfcontract - 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
- Enhancement: make
@pattern_matchinstance variable not render ruby warning. Required to use new aruba versions in rspec tests - Dennis Günnewig #179
- Bugfix: make
Maybe[Proc]work correctly - Simon George #142 - Bugfix: make
Funccontract verified when used as return contract - Rob Rosenbaum #145 - Bugfix: make
Pos,NegandNatcontracts 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
KeywordArgsandOptionalcontracts 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
-
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
SetOfcontract -
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
Invarianttoinvariant:invariant(:day) { 1 <= day && day <= 31 } - prettier error messages (
Contracts::Numis now justNum, for example) - support for yard-contracts