Class: Mammoth::Status
- Inherits:
-
Object
- Object
- Mammoth::Status
- Defined in:
- lib/mammoth/status.rb
Overview
Builds and prints a boring operational status snapshot.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#state_adapter ⇒ Object
readonly
Returns the value of attribute state_adapter.
Class Method Summary collapse
-
.call(config, state_adapter: nil, output: $stdout) ⇒ void
Print status for a configuration and optional operational-state adapter.
Instance Method Summary collapse
-
#call ⇒ void
Print the status snapshot.
-
#initialize(config, state_adapter: nil, output: $stdout) ⇒ Status
constructor
A new instance of Status.
Constructor Details
#initialize(config, state_adapter: nil, output: $stdout) ⇒ Status
Returns a new instance of Status.
20 21 22 23 24 |
# File 'lib/mammoth/status.rb', line 20 def initialize(config, state_adapter: nil, output: $stdout) @config = config @state_adapter = state_adapter @output = output end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/mammoth/status.rb', line 6 def config @config end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
6 7 8 |
# File 'lib/mammoth/status.rb', line 6 def output @output end |
#state_adapter ⇒ Object (readonly)
Returns the value of attribute state_adapter.
6 7 8 |
# File 'lib/mammoth/status.rb', line 6 def state_adapter @state_adapter end |
Class Method Details
.call(config, state_adapter: nil, output: $stdout) ⇒ void
This method returns an undefined value.
Print status for a configuration and optional operational-state adapter.
13 14 15 |
# File 'lib/mammoth/status.rb', line 13 def self.call(config, state_adapter: nil, output: $stdout) new(config, state_adapter: state_adapter, output: output).call end |
Instance Method Details
#call ⇒ void
This method returns an undefined value.
Print the status snapshot.
29 30 31 32 |
# File 'lib/mammoth/status.rb', line 29 def call status_lines.each { |line| output.puts(line) } print_store_state if state_adapter end |