Sha256: d930d57583a727ec95d3cc7350143c134096c6b56b818741879c1d2ef203dc55

Contents?: true

Size: 819 Bytes

Versions: 2

Compression:

Stored size: 819 Bytes

Contents

require 'active_support/configurable'

module Rescue

  def self.configure(&block)
    yield @config ||= Rescue::Configuration.new
  end

  def self.config
    @config
  end

  class Configuration #:nodoc:
    include ActiveSupport::Configurable
    config_accessor :respond_name
    config_accessor :suppress_response_codes

    def param_name
      config.param_name.respond_to?(:call) ? config.param_name.call : config.param_name
    end

    # define param_name writer (copied from AS::Configurable)
    writer, line = 'def param_name=(value); config.param_name = value; end', __LINE__
    singleton_class.class_eval writer, __FILE__, line
    class_eval writer, __FILE__, line
  end

  configure do |config|
    config.respond_name            = :respond_status
    config.suppress_response_codes = false
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rescue-dog-0.2.1 lib/rescue/config.rb
rescue-dog-0.2.0 lib/rescue/config.rb