Class: SaferRailsConsole::Configuration

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::Configurable
Defined in:
lib/safer_rails_console.rb

Constant Summary collapse

CONFIG_DEFAULTS =
{
    console: 'irb',
    environment_names: {
        'development' => 'dev',
        'staging' => 'staging',
        'production' => 'prod'
    },
    environment_prompt_colors: {
        'development' => SaferRailsConsole::Colors::GREEN,
        'staging' => SaferRailsConsole::Colors::YELLOW,
        'production' => SaferRailsConsole::Colors::RED
    },
    sandbox_environments: ['production'],
    sandbox_prompt: false,
    warn_environments: ['production'],
    warn_text: "WARNING: YOU ARE USING RAILS CONSOLE IN PRODUCTION!\n" \
               'Changing data can cause serious data loss. ' \
               'Make sure you know what you\'re doing.'
}.freeze

Instance Method Summary collapse

Instance Method Details

#set(**new_config) ⇒ Object



88
89
90
# File 'lib/safer_rails_console.rb', line 88

def set(**new_config)
  config.merge!(new_config.select { |k, _v| CONFIG_DEFAULTS.key?(k) })
end