class Spyke::NormalizedValidationError

Constants

ERROR_KEY

Public Class Methods

new(attributes) click to toggle source
# File lib/spyke/normalized_validation_error.rb, line 5
def initialize(attributes)
  @attributes = attributes
end

Public Instance Methods

message() click to toggle source
# File lib/spyke/normalized_validation_error.rb, line 9
def message
  case @attributes
  when String
    @attributes
  when Hash
    @attributes[ERROR_KEY].to_sym
  end
end
options() click to toggle source
# File lib/spyke/normalized_validation_error.rb, line 18
def options
  case @attributes
  when String
    {}
  when Hash
    @attributes.except(ERROR_KEY).symbolize_keys
  end
end