hot_bunnies 1.2.2-java → 1.3.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/hot_bunnies.rb CHANGED
@@ -14,17 +14,61 @@ module HotBunnies
14
14
 
15
15
  import com.rabbitmq.client.AMQP
16
16
 
17
- CONNECTION_PROPERTIES = [:host, :port, :virtual_host, :connection_timeout, :username, :password]
18
-
19
17
  def self.connect(options={})
20
18
  cf = ConnectionFactory.new
21
- CONNECTION_PROPERTIES.each do |property|
22
- if options[property]
23
- cf.send("#{property}=".to_sym, options[property])
24
- end
25
- end
19
+
20
+ cf.host = hostname_from(options) if include_host?(options)
21
+ cf.port = options[:port] if options[:port]
22
+ cf.virtual_host = vhost_from(options) if include_vhost?(options)
23
+ cf.connection_timeout = timeout_from(options) if include_timeout?(options)
24
+ cf.username = username_from(options) if include_username?(options)
25
+ cf.password = password_from(options) if include_password?(options)
26
+
26
27
  cf.new_connection
27
28
  end
29
+
30
+
31
+ protected
32
+
33
+ def self.hostname_from(options)
34
+ options[:host] || options[:hostname] || ConnectionFactory.DEFAULT_HOST
35
+ end
36
+
37
+ def self.include_host?(options)
38
+ !!(options[:host] || options[:hostname])
39
+ end
40
+
41
+ def self.vhost_from(options)
42
+ options[:virtual_host] || options[:vhost] || ConnectionFactory.DEFAULT_VHOST
43
+ end
44
+
45
+ def self.include_vhost?(options)
46
+ !!(options[:virtual_host] || options[:vhost])
47
+ end
48
+
49
+ def self.timeout_from(options)
50
+ options[:connection_timeout] || options[:timeout]
51
+ end
52
+
53
+ def self.include_timeout?(options)
54
+ !!(options[:connection_timeout] || options[:timeout])
55
+ end
56
+
57
+ def self.username_from(options)
58
+ options[:username] || options[:user] || ConnectionFactory.DEFAULT_USER
59
+ end
60
+
61
+ def self.include_username?(options)
62
+ !!(options[:username] || options[:user])
63
+ end
64
+
65
+ def self.password_from(options)
66
+ options[:password] || options[:pass] || ConnectionFactory.DEFAULT_PASS
67
+ end
68
+
69
+ def self.include_password?(options)
70
+ !!(options[:password] || options[:pass])
71
+ end
28
72
  end
29
73
 
30
74
  require 'hot_bunnies/channel'
@@ -117,6 +117,10 @@ module HotBunnies
117
117
  def delivery_tag
118
118
  @envelope.delivery_tag
119
119
  end
120
+
121
+ def routing_key
122
+ @envelope.routing_key
123
+ end
120
124
  end
121
125
 
122
126
  module Subscriber
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module HotBunnies
4
- VERSION = '1.2.2'
4
+ VERSION = '1.3.1'
5
5
  end
metadata CHANGED
@@ -1,25 +1,34 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hot_bunnies
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 1.2.2
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 3
9
+ - 1
10
+ version: 1.3.1
6
11
  platform: java
7
- authors:
12
+ authors:
8
13
  - Theo Hultberg
9
14
  - Michael S. Klishin
10
- autorequire:
15
+ autorequire:
11
16
  bindir: bin
12
17
  cert_chain: []
13
- date: 2011-10-16 00:00:00.000000000 +04:00
14
- default_executable:
18
+
19
+ date: 2011-11-10 00:00:00 Z
15
20
  dependencies: []
21
+
16
22
  description: A object oriented interface to RabbitMQ that uses the Java driver under the hood
17
- email:
23
+ email:
18
24
  - theo@burtcorp.com
19
25
  executables: []
26
+
20
27
  extensions: []
28
+
21
29
  extra_rdoc_files: []
22
- files:
30
+
31
+ files:
23
32
  - .gitignore
24
33
  - .rvmrc
25
34
  - .travis.yml
@@ -49,30 +58,38 @@ files:
49
58
  - spec/integration/queue_unbind_spec.rb
50
59
  - spec/integration/sender_selected_distribution_spec.rb
51
60
  - spec/spec_helper.rb
52
- has_rdoc: true
53
61
  homepage: http://github.com/iconara/hot_bunnies
54
62
  licenses: []
55
- post_install_message:
63
+
64
+ post_install_message:
56
65
  rdoc_options: []
57
- require_paths:
66
+
67
+ require_paths:
58
68
  - lib
59
- required_ruby_version: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - ! '>='
62
- - !ruby/object:Gem::Version
63
- version: '0'
69
+ required_ruby_version: !ruby/object:Gem::Requirement
64
70
  none: false
65
- required_rubygems_version: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
79
  none: false
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ hash: 3
84
+ segments:
85
+ - 0
86
+ version: "0"
71
87
  requirements: []
88
+
72
89
  rubyforge_project: hot_bunnies
73
- rubygems_version: 1.5.1
74
- signing_key:
90
+ rubygems_version: 1.8.10
91
+ signing_key:
75
92
  specification_version: 3
76
93
  summary: Ruby wrapper for the RabbitMQ Java driver
77
94
  test_files: []
78
- ...
95
+