Class: Fairway::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/fairway/config.rb

Defined Under Namespace

Classes: QueueDefinition

Constant Summary collapse

DEFAULT_FACET =
"default"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Config

Returns a new instance of Config.

Yields:

  • (_self)

Yield Parameters:



10
11
12
13
14
15
16
17
# File 'lib/fairway/config.rb', line 10

def initialize
  @redis_options  = {}
  @namespace      = nil
  @facet          = lambda { |message| DEFAULT_FACET }
  @defined_queues = []

  yield self if block_given?
end

Instance Attribute Details

#defined_queuesObject (readonly)

Returns the value of attribute defined_queues.



4
5
6
# File 'lib/fairway/config.rb', line 4

def defined_queues
  @defined_queues
end

#namespaceObject

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

#redisObject



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=(options)
  @redis_options = options
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

#scriptsObject



39
40
41
# File 'lib/fairway/config.rb', line 39

def scripts
  @scripts ||= Scripts.new(raw_redis, @namespace)
end