Class: NucleusCore::ErrorView
- Inherits:
-
View
- Object
- SimpleObject
- View
- NucleusCore::ErrorView
- Defined in:
- lib/nucleus_core/views/error_view.rb
Instance Attribute Summary
Attributes inherited from SimpleObject
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ ErrorView
constructor
A new instance of ErrorView.
- #json_response ⇒ Object
Methods inherited from SimpleObject
Constructor Details
#initialize(attrs = {}) ⇒ ErrorView
Returns a new instance of ErrorView.
5 6 7 8 9 10 11 12 13 |
# File 'lib/nucleus_core/views/error_view.rb', line 5 def initialize(attrs={}) super( {}.tap do |a| a[:status] = attrs.fetch(:status, :unprocessable_entity) a[:message] = attrs.fetch(:message, nil) a[:errors] = attrs.fetch(:errors, []) end ) end |
Instance Method Details
#json_response ⇒ Object
15 16 17 |
# File 'lib/nucleus_core/views/error_view.rb', line 15 def json_response NucleusCore::JsonResponse.new(content: to_h, status: status) end |