class Kind::Error
Constants
- INVALID_DEFAULT_ARG
Public Class Methods
invalid_default_arg!()
click to toggle source
# File lib/kind/basic/error.rb, line 11 def self.invalid_default_arg! raise ArgumentError, INVALID_DEFAULT_ARG end
new(arg, object = UNDEFINED, label: nil)
click to toggle source
Calls superclass method
# File lib/kind/basic/error.rb, line 15 def initialize(arg, object = UNDEFINED, label: nil) if UNDEFINED == object # Will be used when the exception was raised with a message. e.g: # raise Kind::Error, "some message" super(arg) else label_text = label ? "#{label}: " : '' super("#{label_text}#{object.inspect} expected to be a kind of #{arg}") end end
wrong_number_of_args!(given:, expected:)
click to toggle source
# File lib/kind/basic/error.rb, line 7 def self.wrong_number_of_args!(given:, expected:) raise ArgumentError, "wrong number of arguments (given #{given}, expected #{expected})" end