module Knot::Errors

Attributes

err2exc[R]
key2exc[R]
num2exc[R]

Public Class Methods

array_arguments_with_typecheck(*args) click to toggle source
# File lib/knot/errors.rb, line 16
def array_arguments_with_typecheck *args
        l = args.length
        lambda do |a|
                l == a.length and
                        args.zip(a).all? {|t,v| t === v }
        end
end

Public Instance Methods

[](key_or_errno) click to toggle source
# File lib/knot/errors.rb, line 29
def [] key_or_errno
        case key_or_errno
        when Integer
                @num2exc[key_or_errno]
        when Exception
                key_or_errno
        when Symbol
                @key2exc[key_or_errno]
        else
                raise ArgumentError, "Invalid type. Expect Integer/Knot::Error/Symbol"
        end
end
method_missing(key) click to toggle source
# File lib/knot/errors.rb, line 25
def method_missing key
        self[key]
end