~singpolyma/dhall-ruby

ref: b730651e6b3b37087c71978b9665854114ef8dc6 dhall-ruby/lib/dhall/util.rb -rw-r--r-- 331 bytes
b730651eStephen Paul Weber All beta normalization except for functions 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