msgr 0.13.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e94aa29e884fd4e1b008efe5076f213243a33677
4
- data.tar.gz: c88508a57afd05a6bdce91c847e444a2372eb375
3
+ metadata.gz: f09325407644d7b71c70a7b6815d981bd3640f09
4
+ data.tar.gz: 5a80dee22396644935fa18a3bec0f26b0a23b223
5
5
  SHA512:
6
- metadata.gz: 73224563fc200eb0774e4c93fe8f15f7c60a4a87af0ee2838f41797d5eca5ab6d4cddb96b0002ec9f73cf9388dec690c1f7c2466f9a98fd3e31d0f4f6911f407
7
- data.tar.gz: f0d8baa1b8f99cea91e0d7a4a85b1d716271793234328017f3cfc58e5c63c8ef8d81f1699cfcfb91b6a04f55a1cd894a3ac5c635260d77cce3337e9fbbdc42e0
6
+ metadata.gz: 659863ef2373f2305081293b59ced345169f653afd8cc0a1a405f233291983b58e480ef3428d60b205a37a10690a2e8ed715bff6f99220e1d8ceca6b31508a09
7
+ data.tar.gz: bb93d514a3a07783a8a19bf8975020124f7d80a068f3c7598cf4e99608603677a1e67a6a7d5ab0bd0f3a41d2a3c2958b282802f8eeac9d9e7340a70cf21f0fb5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.14.0
4
+
5
+ * Add experimental test pool (`Msgr::TestPool`)
6
+
3
7
  ## 0.13.0
4
8
 
5
9
  * Use `Rails.application.config_for` if available.
@@ -0,0 +1,44 @@
1
+ module Msgr
2
+ class TestPool
3
+ def initialize(*)
4
+ @mutex = Mutex.new
5
+ @queue = []
6
+ end
7
+
8
+ def post(*args, &block)
9
+ @mutex.synchronize { @queue << [block, args] }
10
+ end
11
+
12
+ def run(timeout: 5, count: 1)
13
+ Timeout.timeout(timeout) do
14
+ while count > 0
15
+ @mutex.synchronize do
16
+ if (item = @queue.pop)
17
+ item[0].call(*item[1])
18
+
19
+ count -= 1
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+
26
+ def reset
27
+ @queue.clear
28
+ end
29
+
30
+ class << self
31
+ def new(*args)
32
+ @instance ||= super(*args)
33
+ end
34
+
35
+ def run(*args)
36
+ new.run(*args)
37
+ end
38
+
39
+ def reset
40
+ @instance ? @instance.reset : nil
41
+ end
42
+ end
43
+ end
44
+ end
data/lib/msgr/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Msgr
2
2
  module VERSION
3
3
  MAJOR = 0
4
- MINOR = 13
4
+ MINOR = 14
5
5
  PATCH = 0
6
6
  STAGE = nil
7
7
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-24 00:00:00.000000000 Z
11
+ date: 2016-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -102,6 +102,7 @@ files:
102
102
  - lib/msgr/railtie.rb
103
103
  - lib/msgr/route.rb
104
104
  - lib/msgr/routes.rb
105
+ - lib/msgr/test_pool.rb
105
106
  - lib/msgr/version.rb
106
107
  - msgr.gemspec
107
108
  - scripts/simple_test.rb
@@ -182,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
183
  version: '0'
183
184
  requirements: []
184
185
  rubyforge_project:
185
- rubygems_version: 2.4.8
186
+ rubygems_version: 2.5.1
186
187
  signing_key:
187
188
  specification_version: 4
188
189
  summary: 'Msgr: Rails-like Messaging Framework'