Sha256: 0b678ed30aa24146c4690eca4ddec50abda46c701b7a7671c9c48e6e70b128a3
Contents?: true
Size: 1015 Bytes
Versions: 1
Compression:
Stored size: 1015 Bytes
Contents
require "standard_exceptions/version" module StandardExceptions # messages are based on http://httpstatuses.com class Exception < ::StandardError MESSAGE = 'An error occurred that could not be identified' STATUS = 500 attr_accessor :status # eg. 'Not Found' def self.human_name(e_class=self) i = e_class.name.rindex('::') base_name = e_class.name[(i+2)..-1] base_name.split(/(?=[A-Z])/).join(' ') end def human_name self.class.human_name end attr_writer :inner def inner @inner || self.cause end def initialize(message=nil,status=nil,inner=nil) super(message || self.class::MESSAGE) @status = (status || self.class::STATUS) @inner = inner end end end require 'standard_exceptions/http' require 'standard_exceptions/application' require 'standard_exceptions/http_methods' require 'standard_exceptions/application_methods' module StandardExceptions::Methods include StandardExceptions::HttpMethods include StandardExceptions::ApplicationMethods end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
standard_exceptions-0.1.3 | lib/standard_exceptions.rb |