Class: Stealth::Commands::Console

Inherits:
Command
  • Object
show all
Defined in:
lib/stealth/commands/console.rb

Overview

REPL that supports different engines.

It is run with:

`bundle exec stealth console`

Defined Under Namespace

Modules: CodeReloading

Constant Summary collapse

ENGINES =

Supported engines

{
  'pry'  => 'Pry',
  'ripl' => 'Ripl',
  'irb'  => 'IRB'
}.freeze
DEFAULT_ENGINE =
['irb'].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Console

Returns a new instance of Console.



32
33
34
35
36
# File 'lib/stealth/commands/console.rb', line 32

def initialize(options)
  super(options)

  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



30
31
32
# File 'lib/stealth/commands/console.rb', line 30

def options
  @options
end

Instance Method Details

#engineObject



43
44
45
# File 'lib/stealth/commands/console.rb', line 43

def engine
  load_engine options.fetch(:engine) { engine_lookup }
end

#startObject



38
39
40
41
# File 'lib/stealth/commands/console.rb', line 38

def start
  prepare
  engine.start
end