Class: ExceptionHandler::Config
- Inherits:
-
Object
- Object
- ExceptionHandler::Config
- Defined in:
- lib/exception_handler/config.rb
Constant Summary collapse
- TABLE_NAME =
Default Table Name Has to be “errors” because “exceptions” is a reserved word
:errors- DEFAULTS =
Defaults stackoverflow.com/a/8917301/1143732
{ dev: false, #-> defaults to "false" for dev mode db: false, #-> defaults to :errors if true, else use "table_name" / :table_name email: false, #-> requires string email and ActionMailer social: { facebook: { name: "frontline.utilities", url: "https://facebook.com" }, twitter: { name: "frontlineutils", url: "http://twitter.com" }, youtube: { name: "frontlineutils", url: "https://youtube.com/user" }, linkedin: { name: "frontline-utilities", url: "https://linkedin.com/company" }, fusion: { name: "flutils", url: "https://frontlinefusion.com" } }, layouts: { "400" => nil, # => inherits from "ApplicationController" layout "500" => "exception" }, }
Instance Attribute Summary collapse
-
#db ⇒ Object
DB.
-
#dev ⇒ Object
Instace Objects.
-
#email ⇒ Object
Instace Objects.
-
#layouts ⇒ Object
Instace Objects.
-
#social ⇒ Object
Instace Objects.
Instance Method Summary collapse
-
#initialize(values = nil) ⇒ Config
constructor
Init.
Constructor Details
#initialize(values = nil) ⇒ Config
Init
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/exception_handler/config.rb', line 18 def initialize values=nil defaults = values.present? ? Config::DEFAULTS.deep_merge!(values) : DEFAULTS defaults.each do |k,v| instance_variable_set("@#{k}",v) #-> http://apidock.com/ruby/Object/instance_variable_set end # => Errors raise(Exception, "ExceptionHandler :: Valid Email Required") if @email && !@email.is_a?(String) #raise(Exception, "ExceptionHandler :: Migration Required → Table \"#{db}\" doesn't exist") if @db && !ActiveRecord::Base.connection.table_exists?(db) end |
Instance Attribute Details
#db ⇒ Object
DB
13 14 15 |
# File 'lib/exception_handler/config.rb', line 13 def db @db end |
#dev ⇒ Object
Instace Objects
13 14 15 |
# File 'lib/exception_handler/config.rb', line 13 def dev @dev end |
#email ⇒ Object
Instace Objects
13 14 15 |
# File 'lib/exception_handler/config.rb', line 13 def email @email end |
#layouts ⇒ Object
Instace Objects
13 14 15 |
# File 'lib/exception_handler/config.rb', line 13 def layouts @layouts end |
#social ⇒ Object
Instace Objects
13 14 15 |
# File 'lib/exception_handler/config.rb', line 13 def @social end |