Sha256: 7295971cf3983eeaddd37520208986d0463a9c01eede3d6391678f72824c5c16
Contents?: true
Size: 768 Bytes
Versions: 1
Compression:
Stored size: 768 Bytes
Contents
module Backport class Machine def initialize @stopped = true end def run return unless stopped? @stopped = false yield if block_given? run_server_thread end def stop servers.map(&:stop) servers.clear @stopped = true end def stopped? @stopped ||= false end def start_server server servers.push server end private # @return [Array<Backport::Server>] def servers @servers ||= [] end def run_server_thread servers.map(&:start) until stopped? servers.each do |server| server.tick sleep 0.001 end sleep 0.001 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
backport-0.1.0 | lib/backport/machine.rb |