Class: Qs::Daemon::Configuration
- Inherits:
-
Object
- Object
- Qs::Daemon::Configuration
- Includes:
- NsOptions::Proxy
- Defined in:
- lib/qs/daemon.rb
Instance Attribute Summary collapse
-
#error_procs ⇒ Object
Returns the value of attribute error_procs.
-
#init_procs ⇒ Object
Returns the value of attribute init_procs.
-
#queues ⇒ Object
Returns the value of attribute queues.
Instance Method Summary collapse
-
#initialize(values = nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #routes ⇒ Object
- #to_hash ⇒ Object
- #valid? ⇒ Boolean
- #validate! ⇒ Object
Constructor Details
#initialize(values = nil) ⇒ Configuration
Returns a new instance of Configuration.
292 293 294 295 296 297 |
# File 'lib/qs/daemon.rb', line 292 def initialize(values = nil) super(values) @init_procs, @error_procs = [], [] @queues = [] @valid = nil end |
Instance Attribute Details
#error_procs ⇒ Object
Returns the value of attribute error_procs.
289 290 291 |
# File 'lib/qs/daemon.rb', line 289 def error_procs @error_procs end |
#init_procs ⇒ Object
Returns the value of attribute init_procs.
289 290 291 |
# File 'lib/qs/daemon.rb', line 289 def init_procs @init_procs end |
#queues ⇒ Object
Returns the value of attribute queues.
290 291 292 |
# File 'lib/qs/daemon.rb', line 290 def queues @queues end |
Instance Method Details
#routes ⇒ Object
299 300 301 |
# File 'lib/qs/daemon.rb', line 299 def routes @queues.map(&:routes).flatten end |
#to_hash ⇒ Object
303 304 305 306 307 308 309 |
# File 'lib/qs/daemon.rb', line 303 def to_hash super.merge({ :error_procs => self.error_procs, :queue_redis_keys => self.queues.map(&:redis_key), :routes => self.routes }) end |
#valid? ⇒ Boolean
311 312 313 |
# File 'lib/qs/daemon.rb', line 311 def valid? !!@valid end |
#validate! ⇒ Object
315 316 317 318 319 320 321 322 323 |
# File 'lib/qs/daemon.rb', line 315 def validate! return @valid if !@valid.nil? self.init_procs.each(&:call) if self.queues.empty? || !self.required_set? raise InvalidError, "a name and queue must be configured" end self.routes.each(&:validate!) @valid = true end |