Class: Contracts::Builtin::StrictHash
- Inherits:
-
CallableClass
- Object
- CallableClass
- Contracts::Builtin::StrictHash
- Defined in:
- lib/contracts/builtin_contracts.rb
Overview
Use this to specify the Hash characteristics. This contracts fails if there are any extra keys that don’t have contracts on them. Example: StrictHash[{ a: String, b: Bool }]
Instance Attribute Summary collapse
-
#contract_hash ⇒ Object
readonly
Returns the value of attribute contract_hash.
Instance Method Summary collapse
-
#initialize(contract_hash) ⇒ StrictHash
constructor
A new instance of StrictHash.
- #valid?(arg) ⇒ Boolean
Methods inherited from CallableClass
Constructor Details
#initialize(contract_hash) ⇒ StrictHash
Returns a new instance of StrictHash.
409 410 411 |
# File 'lib/contracts/builtin_contracts.rb', line 409 def initialize(contract_hash) @contract_hash = contract_hash end |
Instance Attribute Details
#contract_hash ⇒ Object (readonly)
Returns the value of attribute contract_hash.
407 408 409 |
# File 'lib/contracts/builtin_contracts.rb', line 407 def contract_hash @contract_hash end |