Class: Contracts::HashOf
- Inherits:
-
CallableClass
- Object
- CallableClass
- Contracts::HashOf
- Defined in:
- lib/contracts/builtin_contracts.rb
Overview
Use this to specify the Hash characteristics. Takes two contracts, one for hash keys and one for hash values. Example: HashOf[Symbol, String]
Instance Method Summary collapse
-
#initialize(key, value) ⇒ HashOf
constructor
A new instance of HashOf.
- #to_s ⇒ Object
- #valid?(hash) ⇒ Boolean
Methods inherited from CallableClass
Constructor Details
#initialize(key, value) ⇒ HashOf
Returns a new instance of HashOf.
321 322 323 324 |
# File 'lib/contracts/builtin_contracts.rb', line 321 def initialize(key, value) @key = key @value = value end |
Instance Method Details
#to_s ⇒ Object
333 334 335 |
# File 'lib/contracts/builtin_contracts.rb', line 333 def to_s "Hash<#{@key.to_s}, #{@value.to_s}>" end |