class RSpecLive::Monitor

Public Class Methods

new(suite, display, detail) click to toggle source
# File lib/rspec-live/monitor.rb, line 7
def initialize(suite, display, detail)
  @suite = suite
  @display = display
  @detail = detail
  @quit = false
end

Public Instance Methods

start() click to toggle source
# File lib/rspec-live/monitor.rb, line 14
def start
  @display.update
  while !@quit do
    @display.update if process_updates || @display.update_required?
    sleep 0.05
  end
  rescue Interrupt
end

Private Instance Methods

key_handler() click to toggle source
# File lib/rspec-live/monitor.rb, line 29
def key_handler
  @key_handler ||= KeyHandler.new.tap do |handler|
    handler.on("a") { @detail.toggle_all }
    handler.on("n") { @detail.focus_next }
    handler.on("q") { @quit = true }
    handler.on("r") { @suite.reset }
    handler.on("v") { @detail.cycle_verbosity }
  end
end
process_updates() click to toggle source
# File lib/rspec-live/monitor.rb, line 25
def process_updates
  key_handler.process_updates || @suite.process_updates
end