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.
-
#distribute ⇒ Object
readonly
Returns the value of attribute distribute.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#redis_options ⇒ Object
readonly
Returns the value of attribute redis_options.
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.
65 66 67 68 69 70 71 72 73 |
# File 'lib/fairway/config.rb', line 65 def initialize @redis_options = [] @namespace = nil @distribute = RandomDistribution @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.
59 60 61 |
# File 'lib/fairway/config.rb', line 59 def defined_queues @defined_queues end |
#distribute ⇒ Object (readonly)
Returns the value of attribute distribute.
59 60 61 |
# File 'lib/fairway/config.rb', line 59 def distribute @distribute end |
#namespace ⇒ Object
Returns the value of attribute namespace.
58 59 60 |
# File 'lib/fairway/config.rb', line 58 def namespace @namespace end |
#redis_options ⇒ Object (readonly)
Returns the value of attribute redis_options.
59 60 61 |
# File 'lib/fairway/config.rb', line 59 def @redis_options end |
Instance Method Details
#facet(&block) ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/fairway/config.rb', line 75 def facet(&block) if block_given? @facet = block else @facet end end |
#redis ⇒ Object
91 92 93 |
# File 'lib/fairway/config.rb', line 91 def redis @redis ||= redises end |
#redis=(options) ⇒ Object
87 88 89 |
# File 'lib/fairway/config.rb', line 87 def redis=() @redis_options = [].flatten end |
#register_queue(name, channel = Connection::DEFAULT_CHANNEL) ⇒ Object
83 84 85 |
# File 'lib/fairway/config.rb', line 83 def register_queue(name, channel = Connection::DEFAULT_CHANNEL) @defined_queues << QueueDefinition.new(name, channel) end |