module Colors::Helper
Private Instance Methods
check_fail(exc_class, message)
click to toggle source
# File lib/colors/helper.rb, line 13 def check_fail(exc_class, message) raise exc_class, message, caller(2) end
check_range(value, range, name)
click to toggle 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 #{value} is given" end
check_type(obj, type, name)
click to toggle 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