module SaferRailsConsole

Constants

VERSION

Public Class Methods

config() click to toggle source
# File lib/safer_rails_console.rb, line 52
def config
  @config ||= Configuration.new
end
environment_name() click to toggle source
# File lib/safer_rails_console.rb, line 12
def environment_name
  if ENV.key?('SAFER_RAILS_CONSOLE_ENVIRONMENT_NAME')
    ENV['SAFER_RAILS_CONSOLE_ENVIRONMENT_NAME']
  else
    config.environment_names.key?(::Rails.env.downcase) ? config.environment_names[::Rails.env.downcase] : 'unknown env'
  end
end
prompt_color() click to toggle source
# File lib/safer_rails_console.rb, line 20
def prompt_color
  if ENV.key?('SAFER_RAILS_CONSOLE_PROMPT_COLOR')
    SaferRailsConsole::Colors.const_get(ENV['SAFER_RAILS_CONSOLE_PROMPT_COLOR'].upcase)
  else
    config.environment_prompt_colors.key?(::Rails.env.downcase) ? config.environment_prompt_colors[::Rails.env.downcase] : SaferRailsConsole::Colors::NONE
  end
end
sandbox_environment?() click to toggle source
# File lib/safer_rails_console.rb, line 28
def sandbox_environment?
  if ENV.key?('SAFER_RAILS_CONSOLE_SANDBOX_ENVIRONMENT')
    ActiveModel::Type::Boolean.new.cast(ENV['SAFER_RAILS_CONSOLE_SANDBOX_ENVIRONMENT'])
  else
    config.sandbox_environments.include?(::Rails.env.downcase)
  end
end
warn_environment?() click to toggle source
# File lib/safer_rails_console.rb, line 36
def warn_environment?
  if ENV.key?('SAFER_RAILS_CONSOLE_WARN_ENVIRONMENT')
    ActiveModel::Type::Boolean.new.cast(ENV['SAFER_RAILS_CONSOLE_WARN_ENVIRONMENT'])
  else
    config.warn_environments.include?(::Rails.env.downcase)
  end
end
warn_text() click to toggle source
# File lib/safer_rails_console.rb, line 44
def warn_text
  if ENV.key?('SAFER_RAILS_CONSOLE_WARN_TEXT')
    ENV['SAFER_RAILS_CONSOLE_WARN_TEXT']
  else
    config.warn_text
  end
end