class Servolux::Server
def initialize( name, opts = {}, &block )
* interval
* pid_file
* logger
==== Options
loop at the configured interval.
_options_ hash. The _block_ is run inside a separate thread that will
Creates a new server identified by _name_ and configured from the
Server.new( name, options = {} ) { block }
call-seq:
def initialize( name, opts = {}, &block ) @name = name @mutex = Mutex.new @shutdown = nil self.logger = opts.fetch(:logger, Servolux::NullLogger()) self.interval = opts.fetch(:interval, 0) self.pid_file = opts.fetch(:pid_file, name) if block eg = class << self; self; end eg.__send__(:define_method, :run, &block) end ary = %w[name logger pid_file].map { |var| self.send(var).nil? ? var : nil }.compact raise Error, "These variables are required: #{ary.join(', ')}." unless ary.empty? end