Class: Qs::Config
- Inherits:
-
Object
- Object
- Qs::Config
- Defined in:
- lib/qs.rb
Constant Summary collapse
- DEFAULT_ENCODER =
proc{ |payload| ::JSON.dump(payload) }
- DEFAULT_DECODER =
proc{ |encoded_payload| ::JSON.load(encoded_payload) }
- DEFAULT_DISPATCHER_QUEUE_CLASS =
Queue
- DEFAULT_DISPATCHER_QUEUE_NAME =
'dispatcher'.freeze
- DEFAULT_DISPATCHER_JOB_NAME =
'run_dispatch_job'.freeze
- DEFAULT_DISPATCHER_JOB_HANDLER_CLASS_NAME =
DispatcherQueue::RunDispatchJob.to_s.freeze
- DEFAULT_REDIS_IP =
'127.0.0.1'.freeze
- DEFAULT_REDIS_PORT =
6379.freeze
- DEFAULT_REDIS_DB =
0.freeze
- DEFAULT_REDIS_NS =
'qs'.freeze
- DEFAULT_REDIS_DRIVER =
'ruby'.freeze
- DEFAULT_REDIS_TIMEOUT =
1.freeze
- DEFAULT_REDIS_SIZE =
4.freeze
Instance Attribute Summary collapse
-
#decoder ⇒ Object
Returns the value of attribute decoder.
-
#dispatcher_job_handler_class_name ⇒ Object
Returns the value of attribute dispatcher_job_handler_class_name.
-
#dispatcher_job_name ⇒ Object
Returns the value of attribute dispatcher_job_name.
-
#dispatcher_queue_class ⇒ Object
Returns the value of attribute dispatcher_queue_class.
-
#dispatcher_queue_name ⇒ Object
Returns the value of attribute dispatcher_queue_name.
-
#encoder ⇒ Object
Returns the value of attribute encoder.
-
#event_publisher ⇒ Object
Returns the value of attribute event_publisher.
-
#redis_db ⇒ Object
Returns the value of attribute redis_db.
-
#redis_driver ⇒ Object
Returns the value of attribute redis_driver.
-
#redis_ip ⇒ Object
Returns the value of attribute redis_ip.
-
#redis_ns ⇒ Object
Returns the value of attribute redis_ns.
-
#redis_port ⇒ Object
Returns the value of attribute redis_port.
-
#redis_size ⇒ Object
Returns the value of attribute redis_size.
-
#redis_timeout ⇒ Object
Returns the value of attribute redis_timeout.
-
#redis_url ⇒ Object
Returns the value of attribute redis_url.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
-
#redis_connect_hash ⇒ Object
the keys here should be compatible with HellaRedis connection configs github.com/redding/hella-redis#connection.
- #valid? ⇒ Boolean
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/qs.rb', line 131 def initialize @encoder = DEFAULT_ENCODER @decoder = DEFAULT_DECODER @timeout = nil @event_publisher = nil @dispatcher_queue_class = DEFAULT_DISPATCHER_QUEUE_CLASS @dispatcher_queue_name = DEFAULT_DISPATCHER_QUEUE_NAME @dispatcher_job_name = DEFAULT_DISPATCHER_JOB_NAME @dispatcher_job_handler_class_name = DEFAULT_DISPATCHER_JOB_HANDLER_CLASS_NAME @redis_ip = DEFAULT_REDIS_IP @redis_port = DEFAULT_REDIS_PORT @redis_db = DEFAULT_REDIS_DB @redis_ns = DEFAULT_REDIS_NS @redis_driver = DEFAULT_REDIS_DRIVER @redis_timeout = DEFAULT_REDIS_TIMEOUT @redis_size = DEFAULT_REDIS_SIZE @redis_url = nil @valid = nil end |
Instance Attribute Details
#decoder ⇒ Object
Returns the value of attribute decoder.
125 126 127 |
# File 'lib/qs.rb', line 125 def decoder @decoder end |
#dispatcher_job_handler_class_name ⇒ Object
Returns the value of attribute dispatcher_job_handler_class_name.
127 128 129 |
# File 'lib/qs.rb', line 127 def dispatcher_job_handler_class_name @dispatcher_job_handler_class_name end |
#dispatcher_job_name ⇒ Object
Returns the value of attribute dispatcher_job_name.
127 128 129 |
# File 'lib/qs.rb', line 127 def dispatcher_job_name @dispatcher_job_name end |
#dispatcher_queue_class ⇒ Object
Returns the value of attribute dispatcher_queue_class.
126 127 128 |
# File 'lib/qs.rb', line 126 def dispatcher_queue_class @dispatcher_queue_class end |
#dispatcher_queue_name ⇒ Object
Returns the value of attribute dispatcher_queue_name.
126 127 128 |
# File 'lib/qs.rb', line 126 def dispatcher_queue_name @dispatcher_queue_name end |
#encoder ⇒ Object
Returns the value of attribute encoder.
125 126 127 |
# File 'lib/qs.rb', line 125 def encoder @encoder end |
#event_publisher ⇒ Object
Returns the value of attribute event_publisher.
125 126 127 |
# File 'lib/qs.rb', line 125 def event_publisher @event_publisher end |
#redis_db ⇒ Object
Returns the value of attribute redis_db.
128 129 130 |
# File 'lib/qs.rb', line 128 def redis_db @redis_db end |
#redis_driver ⇒ Object
Returns the value of attribute redis_driver.
129 130 131 |
# File 'lib/qs.rb', line 129 def redis_driver @redis_driver end |
#redis_ip ⇒ Object
Returns the value of attribute redis_ip.
128 129 130 |
# File 'lib/qs.rb', line 128 def redis_ip @redis_ip end |
#redis_ns ⇒ Object
Returns the value of attribute redis_ns.
128 129 130 |
# File 'lib/qs.rb', line 128 def redis_ns @redis_ns end |
#redis_port ⇒ Object
Returns the value of attribute redis_port.
128 129 130 |
# File 'lib/qs.rb', line 128 def redis_port @redis_port end |
#redis_size ⇒ Object
Returns the value of attribute redis_size.
129 130 131 |
# File 'lib/qs.rb', line 129 def redis_size @redis_size end |
#redis_timeout ⇒ Object
Returns the value of attribute redis_timeout.
129 130 131 |
# File 'lib/qs.rb', line 129 def redis_timeout @redis_timeout end |
#redis_url ⇒ Object
Returns the value of attribute redis_url.
129 130 131 |
# File 'lib/qs.rb', line 129 def redis_url @redis_url end |
#timeout ⇒ Object
Returns the value of attribute timeout.
125 126 127 |
# File 'lib/qs.rb', line 125 def timeout @timeout end |
Instance Method Details
#redis_connect_hash ⇒ Object
the keys here should be compatible with HellaRedis connection configs github.com/redding/hella-redis#connection
156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/qs.rb', line 156 def redis_connect_hash { :ip => self.redis_ip, :port => self.redis_port, :db => self.redis_db, :redis_ns => self.redis_ns, :driver => self.redis_driver, :timeout => self.redis_timeout, :size => self.redis_size, :url => self.redis_url } end |
#valid? ⇒ Boolean
168 169 170 |
# File 'lib/qs.rb', line 168 def valid? !!@valid end |