Sha256: ef6e96369ebeef2a31275d591f10f0ac7be0c5d2c101fac1e546f689516acf66
Contents?: true
Size: 719 Bytes
Versions: 38
Compression:
Stored size: 719 Bytes
Contents
module Daemonizer class Option class OptionError < StandardError; end def initialize(option, value, auto_eval = false) @option = option @value = value @auto_eval = auto_eval if @auto_eval && !@value.is_a?(Proc) raise OptionError, "auto_apply can be used only with callable option" end end def value(handler = nil) if @auto_eval && @value.is_a?(Proc) if handler && handler.worker_id && handler.workers_count return @value.call(handler.worker_id, handler.workers_count) else raise OptionError, "value called before handler initialized" end else @value end end end end
Version data entries
38 entries across 38 versions & 1 rubygems