Sha256: 20769f94ec5c4357deae5d755784439a86876fd65a83167c64f56845b6c50cbb

Contents?: true

Size: 887 Bytes

Versions: 3

Compression:

Stored size: 887 Bytes

Contents

module AutoError
  module Config
    def self.setup( &blk )
      yield self
    end

    mattr_accessor :auth_with
    @@auth_with = nil

    mattr_accessor :auth_helpers
    @@auth_helpers = nil

    mattr_accessor :email_on_error
    @@email_on_error = nil

    mattr_accessor :error_template_renderer
    @@error_template_renderer = nil

    mattr_accessor :data_handlers
    @@data_handlers = nil

    private

    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_on_error = []

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
auto_error-0.0.3 lib/auto_error/config.rb
auto_error-0.0.2 lib/auto_error/config.rb
auto_error-0.0.1 lib/auto_error/config.rb