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: %w{production},
    sandbox_prompt: false,
    warn_environments: %w{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



84
85
86
# File 'lib/safer_rails_console.rb', line 84

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