rabbitmq 1.0.0 → 1.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22054636153b22c167c3ad8d50e9f613d23c7af6
4
- data.tar.gz: 127d9e3cb05f29f76f4c74dd3be37cd64a5e1f0a
3
+ metadata.gz: 4bfa34be8651dfe3efcfeb6f154a75f737019936
4
+ data.tar.gz: 1586b65b879349e5240aebec45551cd0631b6939
5
5
  SHA512:
6
- metadata.gz: dead99ee2adae3bb510d5adfe15c66c973cf4a70b9faee176af1e4ef71870e49b0c29406b7c1ce319f993de8414dfae94ec5dc7474c8f0c2409063e82e16ff61
7
- data.tar.gz: 4bba178bb2a19e0715927f0756bfeaf833da7bcc3a53417c691110881d7a7399b42779a61f78fa5e3ce8723dd4ed5499374297668fe7ca4dc1e176ba34f26f9e
6
+ metadata.gz: 7f0fae5f4d1ed711a1a3b8b0c7cc2385cc5b4318b66954cd3f1077c15367320337877d12e7e96da56811926190a012320b5bddcafd1c5015b9399b74ce4d9139
7
+ data.tar.gz: bbc35a0b0f0fbb85cbb78c767ecca4379b7bb1f93c7686f4ab5cd9447845a213436e0c90c2e4f95211c652dce9786b23a0b3224a2d03ab3379c5ce37a9a7ab2f
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  A Ruby [RabbitMQ](https://www.rabbitmq.com/features.html) client library based on [FFI](https://github.com/ffi/ffi/wiki) bindings for [librabbitmq](https://github.com/alanxz/rabbitmq-c).
8
8
 
9
- ##### `$ gem install rabbitmq -v 1.0.0-pre`
9
+ ##### `$ gem install rabbitmq`
10
10
 
11
11
  ## Design Goals
12
12
 
@@ -103,15 +103,19 @@ module RabbitMQ
103
103
  @server_properties = FFI::Table.new(FFI.amqp_get_server_properties(@ptr)).to_h
104
104
  end
105
105
 
106
+ # Calculate the amount of the timeout remaining from the given start time
107
+ def remaining_timeout(timeout=0, start=Time.now)
108
+ return nil unless timeout
109
+ timeout = timeout - (Time.now - start)
110
+ timeout < 0 ? 0 : timeout
111
+ end
112
+
106
113
  # Block until there is readable data on the internal ruby socket,
107
114
  # returning true if there is readable data, or false if time expired.
108
115
  def select(timeout=0, start=Time.now)
109
- if timeout
110
- timeout = timeout - (start-Time.now)
111
- timeout = 0 if timeout < 0
112
- end
113
-
114
- IO.select([@ruby_socket], [], [], timeout) ? true : false
116
+ IO.select([@ruby_socket], [], [],
117
+ remaining_timeout(timeout, start)
118
+ ) ? true : false
115
119
  end
116
120
 
117
121
  # Return the next available frame, or nil if time expired.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbitmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe McIlvain