Class: Contracts::Builtin::CallableClass

Inherits:
Object
  • Object
show all
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.

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