Class: Contracts::Builtin::CallableClass
- Inherits:
-
Object
- Object
- Contracts::Builtin::CallableClass
- Includes:
- Formatters
- Defined in:
- 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
91 92 93 |
# File 'lib/contracts/builtin_contracts.rb', line 91 def self.[](*vals) new(*vals) end |