class Contracts::Builtin::Send
Takes a variable number of method names as symbols. Given an argument, all of those methods are called on the argument one by one. If they all return true, the contract passes. Example: Send[:valid?]
Public Class Methods
new(*meths)
click to toggle source
Calls superclass method
# File lib/contracts/builtin_contracts.rb, line 199 def initialize(*meths) super() @meths = meths end
Public Instance Methods
to_s()
click to toggle source
# File lib/contracts/builtin_contracts.rb, line 210 def to_s "a value that returns true for all of #{@meths.inspect}" end
valid?(val)
click to toggle source
# File lib/contracts/builtin_contracts.rb, line 204 def valid?(val) @meths.all? do |meth| val.send(meth) end end