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, CollectionOf, DescendantOf, Enum, Eq, Exactly, Func, HashOf, KeywordArgs, Not, Optional, Or, RangeOf, RespondTo, Send, SplatArgs, StrictHash, Xor
Class Method Summary collapse
Class Method Details
.[](*vals) ⇒ Object
85 86 87 |
# File 'lib/contracts/builtin_contracts.rb', line 85 def self.[](*vals) new(*vals) end |