class ValueSemantics::HashOf
Validator that matches +Hash+es with homogeneous keys and values
Attributes
key_validator[R]
value_validator[R]
Public Class Methods
new(key_validator, value_validator)
click to toggle source
# File lib/value_semantics/hash_of.rb, line 8 def initialize(key_validator, value_validator) @key_validator, @value_validator = key_validator, value_validator freeze end
Public Instance Methods
===(value)
click to toggle source
@return [Boolean]
# File lib/value_semantics/hash_of.rb, line 14 def ===(value) Hash === value && value.all? do |key, value| key_validator === key && value_validator === value end end