Class: Jsapi::Meta::RescueHandler
- Inherits:
-
Object
- Object
- Jsapi::Meta::RescueHandler
- Defined in:
- lib/jsapi/meta/rescue_handler.rb
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(klass, status: nil) ⇒ RescueHandler
constructor
A new instance of RescueHandler.
-
#inspect ⇒ Object
:nodoc:.
- #match?(exception) ⇒ Boolean
Constructor Details
#initialize(klass, status: nil) ⇒ RescueHandler
Returns a new instance of RescueHandler.
8 9 10 11 12 13 14 15 |
# File 'lib/jsapi/meta/rescue_handler.rb', line 8 def initialize(klass, status: nil) unless klass.is_a?(Class) && klass.ancestors.include?(StandardError) raise ArgumentError, "#{klass.inspect} must be a standard error class" end @klass = klass @status = status || 'default' end |
Instance Attribute Details
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/jsapi/meta/rescue_handler.rb', line 6 def status @status end |
Instance Method Details
#inspect ⇒ Object
:nodoc:
17 18 19 |
# File 'lib/jsapi/meta/rescue_handler.rb', line 17 def inspect # :nodoc: "#<#{self.class.name} class: #{@klass}, status: #{@status.inspect}>" end |
#match?(exception) ⇒ Boolean
21 22 23 |
# File 'lib/jsapi/meta/rescue_handler.rb', line 21 def match?(exception) exception.is_a?(@klass) end |