Class: Hanami::CLI::Repl::Core Private

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

Direct Known Subclasses

Irb, Pry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, opts) ⇒ Core

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 Core.

Since:

  • 2.0.0



19
20
21
22
# File 'lib/hanami/cli/repl/core.rb', line 19

def initialize(app, opts)
  @app = app
  @opts = opts
end

Instance Attribute Details

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

  • 2.0.0



14
15
16
# File 'lib/hanami/cli/repl/core.rb', line 14

def app
  @app
end

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

  • 2.0.0



15
16
17
# File 'lib/hanami/cli/repl/core.rb', line 15

def opts
  @opts
end

Instance Method Details

#contextObject

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



32
33
34
# File 'lib/hanami/cli/repl/core.rb', line 32

def context
  @context ||= Hanami::Console::Context.new(app)
end

#envObject

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



51
52
53
# File 'lib/hanami/cli/repl/core.rb', line 51

def env
  app.container.env
end

#inflectorObject

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



57
58
59
# File 'lib/hanami/cli/repl/core.rb', line 57

def inflector
  app.inflector
end

#nameObject

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



44
45
46
47
# File 'lib/hanami/cli/repl/core.rb', line 44

def name
  (app.container.config.name || inflector.underscore(app.name))
    .to_s.split("/")[0]
end

#promptObject

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



38
39
40
# File 'lib/hanami/cli/repl/core.rb', line 38

def prompt
  "#{name}[#{env}]"
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.

Raises:

Since:

  • 2.0.0



26
27
28
# File 'lib/hanami/cli/repl/core.rb', line 26

def start
  raise Hanami::CLI::NotImplementedError
end