Class: Hanami::CLI::Repl::Irb Private

Inherits:
Core
  • Object
show all
Defined in:
lib/hanami/cli/repl/irb.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.

Since:

  • 2.0.0

Instance Attribute Summary

Attributes inherited from Core

#app, #opts

Instance Method Summary collapse

Methods inherited from Core

#context, #env, #inflector, #initialize, #name, #prompt

Constructor Details

This class inherits a constructor from Hanami::CLI::Repl::Core

Instance Method Details

#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:

  • 2.0.0



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/hanami/cli/repl/irb.rb', line 14

def start
  $stdout.sync = true

  ARGV.shift until ARGV.empty?
  TOPLEVEL_BINDING.eval("self").extend(context)

  # Initializes the IRB.conf; our own conf changes must be after this
  IRB.setup(nil)

  IRB.conf[:PROMPT][:HANAMI] = {
    AUTO_INDENT: true,
    PROMPT_I: "#{prompt}> ",
    PROMPT_N: "#{prompt}> ",
    PROMPT_S: "#{prompt}%l ",
    PROMPT_C: "#{prompt}* ",
    RETURN: "=> %s\n"
  }

  IRB.conf[:PROMPT_MODE] = :HANAMI

  IRB::Irb.new.run
end