Sha256: f642b2093e47256a0b13be0f6e0a0b812e055f871bd4ed7303ebc6a743b3ce51
Contents?: true
Size: 828 Bytes
Versions: 65
Compression:
Stored size: 828 Bytes
Contents
# frozen_string_literal: true class Code class Type class Or < Type attr_reader :left, :right def initialize(left, right) @left = left @right = right end def valid?(argument) valid_for?(expected: left, actual: argument) || valid_for?(expected: right, actual: argument) end def min_arguments [min_arguments_of(left), min_arguments_of(right)].min end def max_arguments left_max_arguments = max_arguments_of(left) right_max_arguments = max_arguments_of(right) if left_max_arguments.nil? || right_max_arguments.nil? nil else [left_max_arguments, right_max_arguments].max end end def name "(#{left.name} | #{right.name})" end end end end
Version data entries
65 entries across 65 versions & 1 rubygems