Sha256: c3f5be18216b47f71980a3310b39241cb980756d9b88e6e76c5c5de4ecb3483e
Contents?: true
Size: 570 Bytes
Versions: 4
Compression:
Stored size: 570 Bytes
Contents
module Restspec::Schema::Types class HashType < BasicType def example_for(attribute) {} end def valid?(attribute, value) is_hash = value.is_a?(Hash) keys = schema_options.fetch(:keys, []) if keys.empty? is_hash else value_type = schema_options.fetch(:value_type, nil) is_hash && keys.all? do |key| has_key = value.has_key?(key) if has_key && value_type has_key && value_type.totally_valid?(attribute, value[key]) end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems