Class: Typespec::Hash
- Inherits:
-
Object
- Object
- Typespec::Hash
- Defined in:
- lib/typespec.rb
Overview
…
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(pairs = {}) ⇒ Hash
constructor
A new instance of Hash.
- #valid?(value) ⇒ Boolean
Constructor Details
Class Method Details
Instance Method Details
#valid?(value) ⇒ Boolean
110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/typespec.rb', line 110 def valid?(value) if value.is_a? ::Hash value.all? do |k, v| @pairs.any? do |pair| pair.zip([k,v]).all? {|typespec, value| typespec.valid?(value)} end end else false end end |