Module: SaferRailsConsole::Console

Extended by:
Colors
Defined in:
lib/safer_rails_console/console.rb

Constant Summary

Constants included from Colors

SaferRailsConsole::Colors::BLACK, SaferRailsConsole::Colors::BLUE, SaferRailsConsole::Colors::CYAN, SaferRailsConsole::Colors::GREEN, SaferRailsConsole::Colors::NONE, SaferRailsConsole::Colors::PINK, SaferRailsConsole::Colors::RED, SaferRailsConsole::Colors::WHITE, SaferRailsConsole::Colors::YELLOW

Class Method Summary collapse

Methods included from Colors

color_text

Class Method Details

.initialize_sandboxObject



8
9
10
# File 'lib/safer_rails_console/console.rb', line 8

def initialize_sandbox
  require 'safer_rails_console/patches/sandbox'
end

.load_configObject



16
17
18
19
20
21
22
23
# File 'lib/safer_rails_console/console.rb', line 16

def load_config
  gem = Gem::Specification.find_by_name('safer_rails_console')
  gem_root = gem.gem_dir
  ARGV.push(
    '-r',
    File.join(gem_root, 'lib', 'safer_rails_console', 'consoles', "#{SaferRailsConsole.config.console}.rb")
  )
end


12
13
14
# File 'lib/safer_rails_console/console.rb', line 12

def print_warning
  puts color_text(SaferRailsConsole.warn_text, SaferRailsConsole.prompt_color) # rubocop:disable Rails/Output
end

.sandbox_user_promptObject



25
26
27
28
29
30
# File 'lib/safer_rails_console/console.rb', line 25

def sandbox_user_prompt
  puts 'Defaulting the console into sandbox mode.' # rubocop:disable Rails/Output
  puts "Type 'disable' to disable. Anything else will begin a sandboxed session:" # rubocop:disable Rails/Output
  input = gets.strip
  input != 'disable'
end