Class: Contracts::Builtin::Func
- Inherits:
-
CallableClass
- Object
- CallableClass
- Contracts::Builtin::Func
- Defined in:
- lib/contracts-ruby2/lib/contracts/builtin_contracts.rb,
lib/contracts-ruby3/lib/contracts/builtin_contracts.rb
Overview
Used to define contracts on functions passed in as arguments. Example: Func[Num => Num] # the function should take a number and return a number
Instance Attribute Summary collapse
-
#contracts ⇒ Object
readonly
Returns the value of attribute contracts.
Instance Method Summary collapse
-
#initialize(*contracts) ⇒ Func
constructor
A new instance of Func.
Methods inherited from CallableClass
Constructor Details
#initialize(*contracts) ⇒ Func
Returns a new instance of Func.
534 535 536 |
# File 'lib/contracts-ruby2/lib/contracts/builtin_contracts.rb', line 534 def initialize(*contracts) @contracts = contracts end |
Instance Attribute Details
#contracts ⇒ Object (readonly)
Returns the value of attribute contracts.
533 534 535 |
# File 'lib/contracts-ruby2/lib/contracts/builtin_contracts.rb', line 533 def contracts @contracts end |