Class: Mammoth::Status

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

Overview

Builds and prints a boring operational status snapshot.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, sqlite_store: nil) ⇒ Status

Returns a new instance of Status.

Parameters:



19
20
21
22
# File 'lib/mammoth/status.rb', line 19

def initialize(config, sqlite_store: nil)
  @config = config
  @sqlite_store = sqlite_store
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



6
7
8
# File 'lib/mammoth/status.rb', line 6

def config
  @config
end

#sqlite_storeObject (readonly)

Returns the value of attribute sqlite_store.



6
7
8
# File 'lib/mammoth/status.rb', line 6

def sqlite_store
  @sqlite_store
end

Class Method Details

.call(config, sqlite_store: nil) ⇒ void

This method returns an undefined value.

Print status for a configuration and optional SQLite store.

Parameters:



13
14
15
# File 'lib/mammoth/status.rb', line 13

def self.call(config, sqlite_store: nil)
  new(config, sqlite_store: sqlite_store).call
end

Instance Method Details

#callvoid

This method returns an undefined value.

Print the status snapshot.



27
28
29
30
31
32
33
# File 'lib/mammoth/status.rb', line 27

def call
  puts "Mammoth: #{config.dig("mammoth", "name")}"
  puts "Runtime: not started"
  puts "SQLite: #{sqlite_path}"
  puts "Webhook: #{config.dig("webhook", "name")}"
  print_store_state if sqlite_store
end