Module: BackgroundBunnies::Bunny::BunnyConfigurators

Defined in:
lib/background_bunnies/bunny.rb

Instance Method Summary collapse

Instance Method Details

#connection_optionsObject



37
38
39
# File 'lib/background_bunnies/bunny.rb', line 37

def connection_options
  @connection_options || DEFAULT_CONNECTION_OPTIONS.dup
end

#connection_options=(options) ⇒ Object



41
42
43
# File 'lib/background_bunnies/bunny.rb', line 41

def connection_options=(options)
  @connection_options
end

#create_broadcaster(connection) ⇒ Object



58
59
60
# File 'lib/background_bunnies/bunny.rb', line 58

def create_broadcaster(connection)
  BackgroundBunnies::Broadcaster.new(connection, queue_name)
end

#create_producer(connection) ⇒ Object



54
55
56
# File 'lib/background_bunnies/bunny.rb', line 54

def create_producer(connection)
  BackgroundBunnies::Producer.new(connection, queue_name)
end

#demodulized_class_nameObject



45
46
47
48
49
50
51
52
# File 'lib/background_bunnies/bunny.rb', line 45

def demodulized_class_name
  path = name
  if i = path.rindex('::')
    path[(i+2)..-1]
  else
    path
  end
end

#group(group_name) ⇒ Object



13
14
15
# File 'lib/background_bunnies/bunny.rb', line 13

def group(group_name)
  @group_name = group_name
end

#group_nameObject



25
26
27
# File 'lib/background_bunnies/bunny.rb', line 25

def group_name
  @group_name || :default
end

#queue(queue_name) ⇒ Object



17
18
19
# File 'lib/background_bunnies/bunny.rb', line 17

def queue(queue_name)
  @queue_name = queue_name.to_s
end

#queue_nameObject



29
30
31
# File 'lib/background_bunnies/bunny.rb', line 29

def queue_name
  @queue_name || demodulized_class_name
end

#queue_typeObject



33
34
35
# File 'lib/background_bunnies/bunny.rb', line 33

def queue_type
  @type || :queue
end

#type(type) ⇒ Object



21
22
23
# File 'lib/background_bunnies/bunny.rb', line 21

def type(type)
  @type = type
end