class Exception

Extensions to Exception to support fOOrth.

Constants

FOORTH_EXCEPTION_CODE

A hash of exception classes and their fOOrth codes.

Public Instance Methods

foorth_code() click to toggle source

Retrieve the fOOrth exception code of this exception.

# File lib/fOOrth/monkey_patch/exceptions.rb, line 66
def foorth_code
  if /^[A-Z]\d\d(,\d\d)*:/ =~ self.message
    result = $MATCH
  else
    klass = self.class

    while (klass)
      break if (result = FOORTH_EXCEPTION_CODE[klass])
      klass = klass.superclass
    end
  end

  result ||= "E??:"
end
foorth_match(target) click to toggle source

Is this exception covered by target?

# File lib/fOOrth/monkey_patch/exceptions.rb, line 82
def foorth_match(target)
  self.foorth_code[0, target.length] == target
end
foorth_message() click to toggle source

Get the error message for this exception.

# File lib/fOOrth/monkey_patch/exceptions.rb, line 87
def foorth_message
  "#{self.foorth_code} #{self.message}"
end