Sha256: 40ae7496e018840a8324d3b9b7e956a39f42e2ffdd487102b2663759c0c08a2d
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
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.each_process do |process| process.tick end end # proxied events [:start, :unmonitor, :stop, :restart].each do |event| eval <<-END def #{event}(process_name = nil) self.each_process do |process| process.dispatch!("#{event}") if process_name.nil? || process.name == process_name end end END end def status status = [] self.each_process do |process| status << [process.name, process.state] end status end protected def each_process(&block) self.processes.each(&block) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
bluepill-0.0.5 | lib/bluepill/group.rb |
bluepill-0.0.4 | lib/bluepill/group.rb |
bluepill-0.0.3 | lib/bluepill/group.rb |
bluepill-0.0.2 | lib/bluepill/group.rb |