Class: Mammoth::Commands::StatusCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/mammoth/commands/status_command.rb

Overview

Reusable local command object for status inspection.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, state_adapter: nil, output: $stdout) ⇒ StatusCommand

Returns a new instance of StatusCommand.

Parameters:



13
14
15
16
17
# File 'lib/mammoth/commands/status_command.rb', line 13

def initialize(config, state_adapter: nil, output: $stdout)
  @config = config
  @state_adapter = state_adapter || OperationalState::Registry.build_configured(config)
  @output = output
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



8
9
10
# File 'lib/mammoth/commands/status_command.rb', line 8

def config
  @config
end

#outputObject (readonly)

Returns the value of attribute output.



8
9
10
# File 'lib/mammoth/commands/status_command.rb', line 8

def output
  @output
end

#state_adapterObject (readonly)

Returns the value of attribute state_adapter.



8
9
10
# File 'lib/mammoth/commands/status_command.rb', line 8

def state_adapter
  @state_adapter
end

Instance Method Details

#callInteger

Execute the status command.

Returns:

  • (Integer)

    process-style status code



22
23
24
25
# File 'lib/mammoth/commands/status_command.rb', line 22

def call
  Status.call(config, state_adapter: state_adapter, output: output)
  0
end