Class: BreakerMachines::Console

Inherits:
Object
  • Object
show all
Defined in:
lib/breaker_machines/console.rb

Overview

Interactive console for debugging and monitoring circuit breakers

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConsole

Returns a new instance of Console.



10
11
12
# File 'lib/breaker_machines/console.rb', line 10

def initialize
  @running = true
end

Class Method Details

.startObject



6
7
8
# File 'lib/breaker_machines/console.rb', line 6

def self.start
  new.run
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/breaker_machines/console.rb', line 14

def run
  print_header
  print_help if BreakerMachines::Registry.instance.all_circuits.empty?

  while @running
    print_prompt
    command = gets&.chomp
    break unless command

    process_command(command)
  end

  puts "\nExiting BreakerMachines Console..."
end