Class: SimpleJsonapi::Errors::ActiveModelError
- Inherits:
-
Object
- Object
- SimpleJsonapi::Errors::ActiveModelError
- Defined in:
- lib/simple_jsonapi/errors/active_model_error.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#pointer ⇒ Object
readonly
Returns the value of attribute pointer.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attribute, message, pointer) ⇒ ActiveModelError
constructor
A new instance of ActiveModelError.
Constructor Details
#initialize(attribute, message, pointer) ⇒ ActiveModelError
Returns a new instance of ActiveModelError.
14 15 16 17 18 |
# File 'lib/simple_jsonapi/errors/active_model_error.rb', line 14 def initialize(attribute, , pointer) @attribute = attribute.to_s @message = .to_s @pointer = pointer.to_s end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
12 13 14 |
# File 'lib/simple_jsonapi/errors/active_model_error.rb', line 12 def attribute @attribute end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
12 13 14 |
# File 'lib/simple_jsonapi/errors/active_model_error.rb', line 12 def @message end |
#pointer ⇒ Object (readonly)
Returns the value of attribute pointer.
12 13 14 |
# File 'lib/simple_jsonapi/errors/active_model_error.rb', line 12 def pointer @pointer end |
Class Method Details
.from_errors(errors, pointer_mapping = {}) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/simple_jsonapi/errors/active_model_error.rb', line 4 def self.from_errors(errors, pointer_mapping = {}) errors.keys.flat_map do |attribute| errors.(attribute).map do || new(attribute, , pointer_mapping[attribute]) end end end |