4
# Copyright (c) 1999,2000 Minero Aoki <aamine@loveruby.net>
6
# This program is free software.
7
# You can distribute/modify this program under the terms of
8
# the GNU General Public License version 2 or later.
17
args.each {|c| return self if c === self }
18
raise TypeError, "wrong arg type '#{type}' for required #{args.join('/')}"
21
def must_have( *args )
23
unless self.respond_to? m then
25
tos = self.to_s; tos = tos[0, 15] + '...' if tos.size > 15
26
raise ArgumentError, "arg #{tos}(#{type}) does not have '#{name}'"
31
alias needed must_have
34
unless self == eq then
35
raise ArgumentError, "expected #{eq.inspect} but is #{inspect}(#{type})"
42
raise ArgumentError, 'is wrongly nil'