Class: ExceptionHandler::Config

Inherits:
Object
  • Object
show all
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 =
{
  dev:    false, #-> defaults to "false" for dev mode

  db:     false, #-> defaults to :errors if true, else use "table_name" / :table_name

  email:  false, #-> need to integrate

  social: {
    :facebook   =>   'frontline.utilities',
    :twitter    =>  'frontlineutils',
    :youtube    =>  'frontlineutils',
    :linkedin   =>   'frontline-utilities',
    :fusion     =>   'frontlineutils',
    :url => {
      :facebook   =>   'https://facebook.com',
      :twitter    =>  'http://twitter.com',
      :youtube    =>  'https://youtube.com/user',
      :linkedin   =>   'https://linkedin.com/company',
      :fusion     =>   'https://frontlinefusion.com',            
    },
  },
  layouts: {
    '404' => nil, #-> 404 Callback (needs improving big time) Use the following: '404' => <<-EOF redirect_to root_url, notice: "Hello" EOF

    '400' => nil, #-> layout for 400 error code (404 should only be used as response)

    '500' => 'exception'
  },
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values = nil) ⇒ Config

Init



18
19
20
21
22
23
# File 'lib/exception_handler/config.rb', line 18

def initialize values=nil
  defaults = values.present? ? Config::DEFAULTS.deep_merge!(values) : Config::DEFAULTS
  defaults.each do |k,v|
    instance_variable_set("@#{k}",v) #-> http://apidock.com/ruby/Object/instance_variable_set 

  end
end

Instance Attribute Details

#dbObject

DB



13
14
15
# File 'lib/exception_handler/config.rb', line 13

def db
  @db
end

#devObject

Instace Objects



13
14
15
# File 'lib/exception_handler/config.rb', line 13

def dev
  @dev
end

#emailObject

Instace Objects



13
14
15
# File 'lib/exception_handler/config.rb', line 13

def email
  @email
end

#layoutsObject

Instace Objects



13
14
15
# File 'lib/exception_handler/config.rb', line 13

def layouts
  @layouts
end

#socialObject

Instace Objects



13
14
15
# File 'lib/exception_handler/config.rb', line 13

def social
  @social
end