Exception: PAPI::Error
- Inherits:
-
StandardError
- Object
- StandardError
- PAPI::Error
- Defined in:
- lib/PAPI/Error.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code) ⇒ Error
constructor
A new instance of Error.
- #name ⇒ Object
Constructor Details
#initialize(code) ⇒ Error
Returns a new instance of Error.
6 7 8 9 |
# File 'lib/PAPI/Error.rb', line 6 def initialize(code) @code = code super("#{code}") end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
4 5 6 |
# File 'lib/PAPI/Error.rb', line 4 def code @code end |
Class Method Details
.error_class(errcode) ⇒ Object
17 18 19 |
# File 'lib/PAPI/Error.rb', line 17 def self.error_class(errcode) return CLASSES[errcode] end |
.name(code) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/PAPI/Error.rb', line 21 def self.name(code) if CLASSES[code] then return CLASSES[code].name else return "#{code}" end end |
.register_error(code, symbol) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/PAPI/Error.rb', line 33 def self.register_error(code, symbol) s = <<EOF class #{symbol} < Error def initialize super(#{code}) end def self.name return "#{symbol}" end def name return "#{symbol}" end def self.code return #{code} end end CLASSES[#{code}] = #{symbol} EOF end |
Instance Method Details
#name ⇒ Object
29 30 31 |
# File 'lib/PAPI/Error.rb', line 29 def name return "#{@code}" end |