class Contracts::Builtin::Not
Takes a variable number of contracts. The contract passes if all of those contracts fail for the given argument. Example: Not[nil]
Public Class Methods
new(*vals)
click to toggle source
# File lib/contracts/builtin_contracts.rb, line 253 def initialize(*vals) @vals = vals end
Public Instance Methods
to_s()
click to toggle source
# File lib/contracts/builtin_contracts.rb, line 264 def to_s "a value that is none of #{@vals.inspect}" end
valid?(val)
click to toggle source
# File lib/contracts/builtin_contracts.rb, line 257 def valid?(val) @vals.all? do |contract| res, = Contract.valid?(val, contract) !res end end