Class: Dhall::Util::HashOf
- Inherits:
-
Object
- Object
- Dhall::Util::HashOf
- Defined in:
- lib/dhall/util.rb
Instance Method Summary collapse
- #===(other) ⇒ Object
-
#initialize(key_validator, element_validator, min: 0, max: Float::INFINITY) ⇒ HashOf
constructor
A new instance of HashOf.
Constructor Details
#initialize(key_validator, element_validator, min: 0, max: Float::INFINITY) ⇒ HashOf
Returns a new instance of HashOf.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/dhall/util.rb', line 48 def initialize( key_validator, element_validator, min: 0, max: Float::INFINITY ) @min = min @max = max @key_validator = key_validator @element_validator = element_validator end |
Instance Method Details
#===(other) ⇒ Object
60 61 62 63 64 65 |
# File 'lib/dhall/util.rb', line 60 def ===(other) Hash === other && other.keys.all? { |x| @key_validator === x } && other.values.all? { |x| @element_validator === x } && other.size >= @min && other.size <= @max end |