class Probatio::Context
def assert(*as)
Jack of all trade assert
def assert(*as) count = { rexes: 0, hashes: 0, arrays: 0, strings: 0, scalars: 0, others: 0 } as.each { |a| k = case a when Regexp then :rexes when Hash then :hashes when Array then :arrays when String then :strings else :others; end count[k] = count[k] + 1 count[:scalars] += 1 if %i[ rexes strings ].include?(k) } if as.length == 1 && count[:hashes] == 1 assert_hashy(*as) elsif as.length == 1 assert_truthy(*as) elsif count[:rexes] == 1 && count[:strings] == as.length - 1 assert_match(*as) #elsif count[:arrays] > 0 # assert_include(*as) else assert_equal(*as) end end