Module: AutoError::Config

Defined in:
lib/auto_error/config.rb

Constant Summary collapse

@@auth_with =
nil
@@helpers =
nil
@@email_on_error =
nil
@@email_sender =
nil
@@error_template_renderer =
nil
@@data_handlers =
nil

Class Method Summary collapse

Class Method Details

.set_defaultsObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/auto_error/config.rb', line 27

def self.set_defaults
  self.setup do |config|
    config.error_template_renderer = ->( status ) do
      render template: "/errors/#{status}",
             layout: 'errors',
             status: status
    end

    config.email_sender = %{"Notifier" [email protected]}
    config.email_on_error = []
    ExceptionNotifier.add_notifier :email, {}
    # ExceptionNotifier::Notifier.prepend_view_path(
    #   AutoError::Engine.root.join( *%w{app views auto_error} )
    # )

    config.auth_with = ->( c ) { true }
    config.helpers = [ 'ApplicationHelper' ]

    config.data_handlers = Hash.new do |h, k|
      h[k] = ->( value ) { "<strong>#{value}</strong>" }
    end
  end
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



3
4
5
# File 'lib/auto_error/config.rb', line 3

def self.setup( &blk )
  yield self
end