Class: Pigeon::Configuration

Inherits:
Object
  • Object
show all
Extended by:
Dry::Configurable
Defined in:
lib/pigeon/configuration.rb

Overview

Configuration class for Pigeon using dry-configurable

Class Method Summary collapse

Class Method Details

.reset_configvoid

This method returns an undefined value.

Reset the configuration to default values



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/pigeon/configuration.rb', line 47

def reset_config
  # For dry-configurable 1.x
  if respond_to?(:settings)
    settings.each_key do |key|
      config[key] = settings[key].default
    end
  # For dry-configurable 0.x
  elsif respond_to?(:config_option_definitions)
    config_option_definitions.each_key do |key|
      config[key] = config_option_definitions[key].default_value
    end
  else
    # Simplest approach - just create a new configuration
    @config = Dry::Configurable::Config.new
  end
end