Class: Contracts::Builtin::SplatArgs
- Inherits:
-
CallableClass
- Object
- CallableClass
- Contracts::Builtin::SplatArgs
- Defined in:
- lib/contracts/builtin_contracts.rb
Overview
Used for *args
(variadic functions). Takes a contract and uses it to validate every element passed in through *args
. Example: SplatArgs[Or[String, Num]]
Direct Known Subclasses
Instance Attribute Summary collapse
-
#contract ⇒ Object
readonly
Returns the value of attribute contract.
Instance Method Summary collapse
-
#initialize(contract) ⇒ SplatArgs
constructor
A new instance of SplatArgs.
- #to_s ⇒ Object
Methods inherited from CallableClass
Constructor Details
#initialize(contract) ⇒ SplatArgs
Returns a new instance of SplatArgs.
326 327 328 |
# File 'lib/contracts/builtin_contracts.rb', line 326 def initialize(contract) @contract = contract end |
Instance Attribute Details
#contract ⇒ Object (readonly)
Returns the value of attribute contract.
325 326 327 |
# File 'lib/contracts/builtin_contracts.rb', line 325 def contract @contract end |
Instance Method Details
#to_s ⇒ Object
330 331 332 |
# File 'lib/contracts/builtin_contracts.rb', line 330 def to_s "SplatArgs[#{@contract}]" end |