Sha256: 19dfbd33bffa6005575e26e04e924ed09d476c0f79b493683dfa446ffed30557
Contents?: true
Size: 611 Bytes
Versions: 37
Compression:
Stored size: 611 Bytes
Contents
# frozen_string_literal: true class Code class Type def maybe Maybe.new(self) end def repeat(minimum = 0, maximum = nil) Repeat.new(self, minimum:, maximum:) end def |(other) Or.new(self, other) end def valid?(_argument) false end def valid_for?(expected:, actual:) expected.is_a?(Type) ? expected.valid?(actual) : actual.is_a?(expected) end def min_arguments_of(clazz) clazz.is_a?(Type) ? clazz.min_arguments : 1 end def max_arguments_of(clazz) clazz.is_a?(Type) ? clazz.max_arguments : 1 end end end
Version data entries
37 entries across 37 versions & 1 rubygems