Skip to content

Instantly share code, notes, and snippets.

@arefaslani
Created March 5, 2018 08:18
Show Gist options
  • Save arefaslani/9b2b648cb6b1a306ea2d31157b7bead2 to your computer and use it in GitHub Desktop.
Save arefaslani/9b2b648cb6b1a306ea2d31157b7bead2 to your computer and use it in GitHub Desktop.
errors
module Peafowl
module Errors
class JSONAPI
attr_accessor :errors
def initialize
@errors = []
end
def add(options={})
raise StandardError unless options[:title]
error = {}
options.each do |key, value|
error[key.to_sym] = value
end
@errors << error
end
def clear
@errors = []
end
def empty?
@errors.empty?
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment