Sha256: 483dd9400b578dd15b16f59328d26cc25ff545233d5f7dcb57a0f8a88bb4b3ce
Contents?: true
Size: 570 Bytes
Versions: 7
Compression:
Stored size: 570 Bytes
Contents
# frozen_string_literal: true module Strict module Validators class HashOf attr_reader :key_validator, :value_validator def initialize(key_validator, value_validator) @key_validator = key_validator @value_validator = value_validator end def ===(value) Hash === value && value.all? do |k, v| key_validator === k && value_validator === v end end def inspect "HashOf(#{key_validator.inspect} => #{value_validator.inspect})" end alias to_s inspect end end end
Version data entries
7 entries across 7 versions & 1 rubygems