Class: ErrorSerializer
- Inherits:
-
Object
- Object
- ErrorSerializer
- Defined in:
- lib/generators/disco_app/react/templates/app/serializers/error_serializer.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(errors, source: nil, title: nil) ⇒ ErrorSerializer
constructor
A new instance of ErrorSerializer.
- #serializable_hash ⇒ Object
- #serialized_json ⇒ Object
Constructor Details
#initialize(errors, source: nil, title: nil) ⇒ ErrorSerializer
Returns a new instance of ErrorSerializer.
5 6 7 8 9 |
# File 'lib/generators/disco_app/react/templates/app/serializers/error_serializer.rb', line 5 def initialize(errors, source: nil, title: nil) @errors = errors @source = source @title = title end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
3 4 5 |
# File 'lib/generators/disco_app/react/templates/app/serializers/error_serializer.rb', line 3 def errors @errors end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
3 4 5 |
# File 'lib/generators/disco_app/react/templates/app/serializers/error_serializer.rb', line 3 def source @source end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/generators/disco_app/react/templates/app/serializers/error_serializer.rb', line 3 def title @title end |
Instance Method Details
#serializable_hash ⇒ Object
15 16 17 18 19 |
# File 'lib/generators/disco_app/react/templates/app/serializers/error_serializer.rb', line 15 def serializable_hash { errors: formatted_errors } end |
#serialized_json ⇒ Object
11 12 13 |
# File 'lib/generators/disco_app/react/templates/app/serializers/error_serializer.rb', line 11 def serialized_json serializable_hash.to_json end |