Class: Contracts::Builtin::CallableClass
- Inherits:
-
Object
- Object
- Contracts::Builtin::CallableClass
- Includes:
- Formatters
- Defined in:
- lib/contracts-ruby2/lib/contracts/builtin_contracts.rb,
lib/contracts-ruby3/lib/contracts/builtin_contracts.rb
Overview
Use this when you are writing your own contract classes. Allows your contract to be called with []
instead of .new
:
Old: Or.new(param1, param2)
New: Or[param1, param2]
Of course, .new
still works.
Direct Known Subclasses
And, Args, CollectionOf, DescendantOf, Enum, Eq, Exactly, Func, HashOf, KeywordArgs, Not, Optional, Or, RangeOf, RespondTo, Send, StrictHash, Xor
Class Method Summary collapse
Class Method Details
.[](*vals) ⇒ Object
89 90 91 |
# File 'lib/contracts-ruby2/lib/contracts/builtin_contracts.rb', line 89 def self.[](*vals) new(*vals) end |