Module: Baldrick::RunServant

Defined in:
lib/baldrick/run_servant.rb

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object

send configuration messages to the command



17
18
19
# File 'lib/baldrick/run_servant.rb', line 17

def method_missing name, *args, &block
  Baldrick::Command.instance.respond_to?(name) ? Baldrick::Command.instance.send(name, *args, &block) : super(name, args)        
end

Class Method Details

.included(clazz) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/baldrick/run_servant.rb', line 4

def self.included clazz
  # register shutdown hook ONLY when the module is included
  at_exit do
    raise $! if $!
    Baldrick::Command.instance.execute STDOUT
  end 
  
  trap(:INT) do
    Baldrick::Command.instance.stop!
  end     
end