Exception: Merb::ControllerExceptions::Base
- Defined in:
- lib/merb-core/controller/exceptions.rb
Overview
:doc:
Direct Known Subclasses
ClientError, Informational, Redirection, ServerError, Successful
Class Method Summary collapse
-
.inherited(subclass) ⇒ Object
Registers any subclasses with status codes for easy lookup by set_status in Merb::Controller.
-
.name ⇒ Object
Returns String:: The snake cased name of the class without the namespace.
-
.to_i ⇒ Object
Makes it possible to pass a status-code class to render :status.
Instance Method Summary collapse
-
#name ⇒ Object
Returns String:: The snake cased name of the error without the namespace.
Class Method Details
.inherited(subclass) ⇒ Object
Registers any subclasses with status codes for easy lookup by set_status in Merb::Controller.
Inheritance ensures this method gets inherited by any subclasses, so it goes all the way down the chain of inheritance.
Parameters
- subclass<Merb::ControllerExceptions::Base>
-
The Exception class that is inheriting from Merb::ControllerExceptions::Base
128 129 130 131 132 |
# File 'lib/merb-core/controller/exceptions.rb', line 128 def self.inherited(subclass) if subclass.const_defined?(:STATUS) STATUS_CODES[subclass.name.snake_case.to_sym] = subclass.const_get(:STATUS) end end |
.name ⇒ Object
Returns
- String
-
The snake cased name of the class without the namespace.
106 107 108 |
# File 'lib/merb-core/controller/exceptions.rb', line 106 def self.name to_s.snake_case.split('::').last end |
.to_i ⇒ Object
Makes it possible to pass a status-code class to render :status.
Returns
- Fixnum
-
The status code of this exception.
114 115 116 |
# File 'lib/merb-core/controller/exceptions.rb', line 114 def self.to_i STATUS end |
Instance Method Details
#name ⇒ Object
Returns
- String
-
The snake cased name of the error without the namespace.
102 |
# File 'lib/merb-core/controller/exceptions.rb', line 102 def name; self.class.name; end |