Exception: OPP::Error
- Inherits:
-
StandardError
- Object
- StandardError
- OPP::Error
- Defined in:
- lib/opp/errors.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(message = nil, code: nil, path: nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(message = nil, code: nil, path: nil) ⇒ Error
Returns a new instance of Error.
5 6 7 8 9 10 |
# File 'lib/opp/errors.rb', line 5 def initialize( = nil, code: nil, path: nil) super() @code = code || self.class.name.split("::").last .gsub(/([a-z\d])([A-Z])/, "\\1_\\2").downcase.delete_suffix("_error") @path = path end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
3 4 5 |
# File 'lib/opp/errors.rb', line 3 def code @code end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/opp/errors.rb', line 3 def path @path end |