Class: Spyke::NormalizedValidationError
- Inherits:
-
Object
- Object
- Spyke::NormalizedValidationError
- Defined in:
- lib/spyke/normalized_validation_error.rb
Constant Summary collapse
- ERROR_KEY =
:error
Instance Method Summary collapse
-
#initialize(attributes) ⇒ NormalizedValidationError
constructor
A new instance of NormalizedValidationError.
- #message ⇒ Object
- #options ⇒ Object
Constructor Details
#initialize(attributes) ⇒ NormalizedValidationError
Returns a new instance of NormalizedValidationError.
5 6 7 |
# File 'lib/spyke/normalized_validation_error.rb', line 5 def initialize(attributes) @attributes = attributes end |
Instance Method Details
#message ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/spyke/normalized_validation_error.rb', line 9 def case @attributes when String @attributes when Hash @attributes[ERROR_KEY].to_sym end end |
#options ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/spyke/normalized_validation_error.rb', line 18 def case @attributes when String {} when Hash @attributes.except(ERROR_KEY).symbolize_keys end end |