Class: RQ::Configurator

Inherits:
MainHelper show all
Defined in:
lib/rq-3.0.0/configurator.rb

Overview

a Configurator adds key/value pairs to a queue's configuration. these key/value pairs are not currently used, but will be in a future release

Constant Summary

Constants included from Logging

Logging::DIV0, Logging::DIV1, Logging::DIV2, Logging::DIV3, Logging::EOL, Logging::SEC0, Logging::SEC1, Logging::SEC2, Logging::SEC3

Instance Attribute Summary

Attributes inherited from MainHelper

#argv, #cmd, #dot_rq_dir, #env, #fields, #job_stdin, #main, #mode, #options, #q, #qpath, #quiet, #stdin

Instance Method Summary collapse

Methods inherited from MainHelper

#dumping_yaml_tuples, #field_match, #init_job_stdin!, #initialize, #loadio, #loadyaml, #set_q

Methods included from Logging

append_features

Methods included from Logging::LogMethods

#debug, #error, #fatal, #info, #logerr, #logger, #logger=, #warn

Methods included from Util

#alive?, append_features, #btrace, #columnize, #defval, #emsg, #erreq, #errmsg, #escape, #escape!, #exec, export, #fork, #getopt, #hashify, #hms, #host, #hostname, #klass, #maim, #mcp, #realpath, #stamptime, #system, #timestamp, #tmpnam, #uncache, #which_ruby

Constructor Details

This class inherits a constructor from RQ::MainHelper

Instance Method Details

#configureObject

––}}


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rq-3.0.0/configurator.rb', line 16

def configure
#--{{{
  set_q
  attributes = {}
  unless @argv.empty?
    kv_pat = %r/^\s*([^\s]+)\s*=+\s*([^\s]+)\s*$/o
    @q.transaction do
      @argv.each do |arg|
        match = kv_pat.match arg
        if match 
          k, v = match[1], match[2] 
          @q[k] = v
        end
      end
      attributes = @q.attributes
    end
  end
  y attributes
#--}}}
end