famoseagle-carrot 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :patch: 0
3
3
  :major: 0
4
- :minor: 5
4
+ :minor: 6
data/lib/amqp/exchange.rb CHANGED
@@ -1,10 +1,11 @@
1
1
  module Carrot::AMQP
2
2
  class Exchange
3
- attr_accessor :server, :type, :name, :opts, :key
3
+ attr_reader :server, :type, :name, :opts, :key, :carrot
4
4
 
5
- def initialize(server, type, name, opts = {})
6
- @server, @type, @name, @opts = server, type, name, opts
5
+ def initialize(carrot, type, name, opts = {})
6
+ @server, @type, @name, @opts = carrot.server, type, name, opts
7
7
  @key = opts[:key]
8
+ @carrot = carrot
8
9
 
9
10
  unless name == "amq.#{type}" or name == ''
10
11
  server.send_frame(
@@ -40,6 +41,7 @@ module Carrot::AMQP
40
41
  server.send_frame(
41
42
  Protocol::Exchange::Delete.new({ :exchange => name, :nowait => true }.merge(opts))
42
43
  )
44
+ carrot.exchanges.delete(name)
43
45
  end
44
46
 
45
47
  def reset
data/lib/amqp/queue.rb CHANGED
@@ -1,12 +1,13 @@
1
1
  module Carrot::AMQP
2
2
  class Queue
3
- attr_reader :name, :server
3
+ attr_reader :name, :server, :carrot
4
4
  attr_accessor :delivery_tag
5
5
 
6
- def initialize(server, name, opts = {})
7
- @server = server
6
+ def initialize(carrot, name, opts = {})
7
+ @server = carrot.server
8
8
  @opts = opts
9
9
  @name = name
10
+ @carrot = carrot
10
11
  server.send_frame(
11
12
  Protocol::Queue::Declare.new({ :queue => name, :nowait => true }.merge(opts))
12
13
  )
@@ -78,11 +79,12 @@ module Carrot::AMQP
78
79
  server.send_frame(
79
80
  Protocol::Queue::Delete.new({ :queue => name, :nowait => true }.merge(opts))
80
81
  )
82
+ carrot.queues.delete(name)
81
83
  end
82
84
 
83
85
  private
84
86
  def exchange
85
- @exchange ||= Exchange.new(server, :direct, '', :key => name)
87
+ @exchange ||= Exchange.new(carrot, :direct, '', :key => name)
86
88
  end
87
89
 
88
90
  def bindings
data/lib/carrot.rb CHANGED
@@ -34,7 +34,7 @@ class Carrot
34
34
  end
35
35
 
36
36
  def queue(name, opts = {})
37
- queues[name] ||= AMQP::Queue.new(server, name, opts)
37
+ queues[name] ||= AMQP::Queue.new(self, name, opts)
38
38
  end
39
39
 
40
40
  def stop
@@ -46,15 +46,15 @@ class Carrot
46
46
  end
47
47
 
48
48
  def direct(name = 'amq.direct', opts = {})
49
- exchanges[name] ||= Exchange.new(server, :direct, name, opts)
49
+ exchanges[name] ||= AMQP::Exchange.new(self, :direct, name, opts)
50
50
  end
51
51
 
52
52
  def topic(name = 'amq.topic', opts = {})
53
- exchanges[name] ||= Exchange.new(server, :topic, name, opts)
53
+ exchanges[name] ||= AMQP::Exchange.new(self, :topic, name, opts)
54
54
  end
55
55
 
56
56
  def headers(name = 'amq.match', opts = {})
57
- exchanges[name] ||= Exchange.new(server, :headers, name, opts)
57
+ exchanges[name] ||= AMQP::Exchange.new(self, :headers, name, opts)
58
58
  end
59
59
 
60
60
  def exchanges
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: famoseagle-carrot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amos Elliston