Sha256: 77d8265cd939cb2810e98b4820738d0822635bbba7b5c9f612161e837a9a50d0
Contents?: true
Size: 937 Bytes
Versions: 19
Compression:
Stored size: 937 Bytes
Contents
module Bluepill class Group attr_accessor :name, :processes, :logger attr_accessor :process_logger def initialize(name, options = {}) self.name = name self.processes = [] self.logger = options[:logger] end def add_process(process) process.logger = self.logger.prefix_with(process.name) self.processes << process end def tick self.processes.each do |process| process.tick end end # proxied events [:start, :unmonitor, :stop, :restart, :boot!].each do |event| class_eval <<-END def #{event}(process_name = nil) threads = [] self.processes.each do |process| next if process_name && process_name != process.name threads << Thread.new { process.handle_user_command("#{event}") } end threads.each { |t| t.join } end END end end end
Version data entries
19 entries across 19 versions & 1 rubygems