Class: Fairway::Config
- Inherits:
-
Object
- Object
- Fairway::Config
- Defined in:
- lib/fairway/config.rb
Defined Under Namespace
Classes: QueueDefinition
Constant Summary collapse
- DEFAULT_FACET =
"default"
Instance Attribute Summary collapse
-
#defined_queues ⇒ Object
readonly
Returns the value of attribute defined_queues.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
Instance Method Summary collapse
- #facet(&block) ⇒ Object
-
#initialize {|_self| ... } ⇒ Config
constructor
A new instance of Config.
- #redis ⇒ Object
- #redis=(options) ⇒ Object
- #register_queue(name, channel = Connection::DEFAULT_CHANNEL) ⇒ Object
- #scripts ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Config
Returns a new instance of Config.
10 11 12 13 14 15 16 17 |
# File 'lib/fairway/config.rb', line 10 def initialize = {} @namespace = nil @facet = lambda { || DEFAULT_FACET } @defined_queues = [] yield self if block_given? end |
Instance Attribute Details
#defined_queues ⇒ Object (readonly)
Returns the value of attribute defined_queues.
4 5 6 |
# File 'lib/fairway/config.rb', line 4 def defined_queues @defined_queues end |
#namespace ⇒ Object
Returns the value of attribute namespace.
3 4 5 |
# File 'lib/fairway/config.rb', line 3 def namespace @namespace end |
Instance Method Details
#facet(&block) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/fairway/config.rb', line 19 def facet(&block) if block_given? @facet = block else @facet end end |
#redis ⇒ Object
35 36 37 |
# File 'lib/fairway/config.rb', line 35 def redis @redis ||= Redis::Namespace.new(@namespace, redis: raw_redis) end |
#redis=(options) ⇒ Object
31 32 33 |
# File 'lib/fairway/config.rb', line 31 def redis=() = end |
#register_queue(name, channel = Connection::DEFAULT_CHANNEL) ⇒ Object
27 28 29 |
# File 'lib/fairway/config.rb', line 27 def register_queue(name, channel = Connection::DEFAULT_CHANNEL) @defined_queues << QueueDefinition.new(name, channel) end |
#scripts ⇒ Object
39 40 41 |
# File 'lib/fairway/config.rb', line 39 def scripts @scripts ||= Scripts.new(raw_redis, @namespace) end |