Class: Koine::Attributes::Adapter::HashOf
- Defined in:
- lib/koine/attributes/adapter/hash_of.rb
Instance Method Summary collapse
- #for_keys ⇒ Object
- #for_values ⇒ Object
-
#initialize(key_adapter, value_adapter) ⇒ HashOf
constructor
A new instance of HashOf.
Methods inherited from Base
#coerce, #default_value, #with_default_value, #with_nil_value
Constructor Details
#initialize(key_adapter, value_adapter) ⇒ HashOf
Returns a new instance of HashOf.
5 6 7 8 9 |
# File 'lib/koine/attributes/adapter/hash_of.rb', line 5 def initialize(key_adapter, value_adapter) @key_adapter = key_adapter || raise(ArgumentError, 'Invalid key adapter') @value_adapter = value_adapter || raise(ArgumentError, 'Invalid value adapter') with_default_value({}) end |
Instance Method Details
#for_keys ⇒ Object
11 12 13 |
# File 'lib/koine/attributes/adapter/hash_of.rb', line 11 def for_keys @key_adapter end |
#for_values ⇒ Object
15 16 17 |
# File 'lib/koine/attributes/adapter/hash_of.rb', line 15 def for_values @value_adapter end |