module Colors::Helper
Private Instance Methods
Source
# File lib/colors/helper.rb, line 14 def check_fail(exc_class, message) raise exc_class, message, caller(2) end
Source
# File lib/colors/helper.rb, line 8 def check_range(value, range, name) return value if range.cover?(value) check_fail ArgumentError, "#{name} must be in #{range}, but %p is given" % value end
Source
# File lib/colors/helper.rb, line 3 def check_type(obj, type, name) return obj if obj.instance_of?(type) check_fail TypeError, "#{name} must be a #{type}, but #{obj.class} is given" end