~singpolyma/dhall-ruby

ref: d153b8803073ff2b85b0de18e28e70003071b5e9 dhall-ruby/lib/dhall/util.rb -rw-r--r-- 331 bytes
d153b880Stephen Paul Weber Implement many builtins and do Optional section 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module Dhall
	module Util
		class ArrayOf < ValueSemantics::ArrayOf
			def initialize(element_validator, min: 0, max: Float::INFINITY)
				@min = min
				@max = max
				super(element_validator)
			end

			def ===(other)
				super && other.length >= @min && other.length <= @max
			end
		end
	end
end