Class: Hanami::CLI::Commands::App::DB::Command Private

Inherits:
Command show all
Defined in:
lib/hanami/cli/commands/app/db/command.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.

Base class for ‘hanami` CLI commands intended to be executed within an existing Hanami app.

Since:

  • 2.2.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#app, #inflector, inherited, #measure

Methods inherited from Hanami::CLI::Command

#inflector, new

Constructor Details

#initialize(out:, err:, system_call: SystemCall.new, test_env_executor: InteractiveSystemCall.new(out: out, err: err), nested_command: false, **opts) ⇒ Command

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

Since:

  • 2.2.0



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/hanami/cli/commands/app/db/command.rb', line 26

def initialize(
  out:, err:,
  system_call: SystemCall.new,
  test_env_executor: InteractiveSystemCall.new(out: out, err: err),
  nested_command: false,
  **opts
)
  super(out: out, err: err, **opts)
  @system_call = system_call
  @test_env_executor = test_env_executor
  @nested_command = nested_command
end

Instance Attribute Details

#system_callObject (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.2.0



21
22
23
# File 'lib/hanami/cli/commands/app/db/command.rb', line 21

def system_call
  @system_call
end

#test_env_executorObject (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.2.0



24
25
26
# File 'lib/hanami/cli/commands/app/db/command.rb', line 24

def test_env_executor
  @test_env_executor
end

Instance Method Details

#nested_command?Boolean

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:

  • (Boolean)

Since:

  • 2.2.0



49
50
51
# File 'lib/hanami/cli/commands/app/db/command.rb', line 49

def nested_command?
  @nested_command
end

#run_command(klass) ⇒ Object

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



39
40
41
42
43
44
45
46
47
# File 'lib/hanami/cli/commands/app/db/command.rb', line 39

def run_command(klass, ...)
  klass.new(
    out: out,
    fs: fs,
    system_call: system_call,
    test_env_executor: test_env_executor,
    nested_command: true
  ).call(...)
end