Class: DaemonicThreads::Daemons

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-daemonic-threads/daemons.rb

Instance Method Summary collapse

Constructor Details

#initialize(process) ⇒ Daemons

Returns a new instance of Daemons.



19
20
21
22
23
24
25
# File 'lib/ruby-daemonic-threads/daemons.rb', line 19

def initialize(process)
  @daemons = {}
  
  process.config.daemons.each do |name, config|
    @daemons[name] = DaemonicThreads::Runner.new(name, config, process)
  end
end

Instance Method Details

#[](name) ⇒ Object



27
28
29
# File 'lib/ruby-daemonic-threads/daemons.rb', line 27

def [] name
  @daemons[name]
end

#joinObject



35
36
37
# File 'lib/ruby-daemonic-threads/daemons.rb', line 35

def join
  each_daemon :join
end

#startObject



31
32
33
# File 'lib/ruby-daemonic-threads/daemons.rb', line 31

def start
  each_daemon :start
end

#stopObject



39
40
41
# File 'lib/ruby-daemonic-threads/daemons.rb', line 39

def stop
  each_daemon :stop
end