Class: Lotus::Commands::Console Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

REPL that supports different engines.

It is run with:

`bundle exec lotus console`

Since:

  • 0.1.0

Defined Under Namespace

Modules: Methods

Constant Summary collapse

ENGINES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

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

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

'irb'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Console

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Console.

Parameters:

  • options (Hash)

    Environment’s options

See Also:

Since:

  • 0.1.0



34
35
36
37
# File 'lib/lotus/commands/console.rb', line 34

def initialize(options)
  @environment = Lotus::Environment.new(options)
  @options     = @environment.to_options
end

Instance Attribute Details

#optionsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



28
29
30
# File 'lib/lotus/commands/console.rb', line 28

def options
  @options
end

Instance Method Details

#engineObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



54
55
56
# File 'lib/lotus/commands/console.rb', line 54

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

#startObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/lotus/commands/console.rb', line 40

def start
  # Clear out ARGV so Pry/IRB don't attempt to parse the rest
  ARGV.shift until ARGV.empty?
  @environment.require_application_environment

  # Add convenience methods to the main:Object binding
  TOPLEVEL_BINDING.eval('self').send(:include, Methods)

  load_application
  engine.start
end