reactor 0.11.0 → 0.11.1

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: e47dd61c52db1bfaa846f2fbb50876b081a1c60b
4
- data.tar.gz: 917e730109e0f193c63706ba55025d2ebb877ee3
3
+ metadata.gz: a676751a31b8f702d1cbd084a9363e6bfcc5cf26
4
+ data.tar.gz: a67b5fdac18be4bb1b61a950af4e23e3d9e0d686
5
5
  SHA512:
6
- metadata.gz: 10185cdd733e3d93292dc9a94f48a35a100411f030dfa4e7d47f687fe794cb659e77d57ae0ad287daa367b203fe6230621430c8292e8aa3abf933cbee8856c00
7
- data.tar.gz: 6687577b3635233ba535a8ada13ab83446c6a90a2273d44157717ac48d9faceafb161913ca6cab4fac56fce158c2996f8f9d67c0f37972c69967b66d993607ca
6
+ metadata.gz: 0cafbfba4b07912a67188de843589fe97e5b7bc00a445803ef8f2b6836173336e37a46f9c9c7bcd0517f65cf0c5cdb9461db63e869b30504236dff2e0b9f8c31
7
+ data.tar.gz: 41616d18f3ef3a6244d084aff2c326f389c061d8839b8fa33aff312c3ab41aefe9c327ac0c776bba18d0c386e45c399c8c4f968dec4a1b24272a1910bd395c75
data/Changes.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Reactor Change Log
2
2
 
3
+ 0.11.1
4
+ -----------
5
+ Bug fix for namespaced Subscribable objects
6
+
3
7
  0.11.0
4
8
  -----------
5
9
  Static Subscriber class names have changed to be more deterministic. THIS _MAY BE_ A BREAKING CHANGE.
@@ -9,5 +13,6 @@ Previously, when you added an `on_event :foo` block to an object, say `MyObject`
9
13
 
10
14
  In 0.11.0, the naming of this dynamically generated worker class has changed to `Reactor::StaticSubscribers::MyObject::FooHandler`.
11
15
  If you require more than one `on_event` block for the same event, you must name the handler so that it is unique and deterministic: i.e. `on_event :foo, handler_name: :do_better` otherwise an exception will be raised at load time.
16
+ This example would generate a `Reactor::StaticSubscribers::MyObject::DoBetter` class for the worker.
12
17
 
13
18
  Because the worker class names are changing, when deploying this change it's important that your Sidekiq queue not have any pending jobs with the old naming scheme, otherwise they will fail to deserialize!
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reactor (0.11.0)
4
+ reactor (0.11.1)
5
5
  activerecord (< 5.0)
6
6
  sidekiq
7
7
 
@@ -25,7 +25,7 @@ GEM
25
25
  builder (3.2.2)
26
26
  byebug (8.2.2)
27
27
  coderay (1.1.0)
28
- concurrent-ruby (1.0.0)
28
+ concurrent-ruby (1.0.1)
29
29
  connection_pool (2.2.0)
30
30
  diff-lcs (1.2.5)
31
31
  i18n (0.7.0)
@@ -57,7 +57,7 @@ GEM
57
57
  diff-lcs (>= 1.2.0, < 2.0)
58
58
  rspec-support (~> 3.4.0)
59
59
  rspec-support (3.4.1)
60
- sidekiq (4.1.0)
60
+ sidekiq (4.1.1)
61
61
  concurrent-ruby (~> 1.0)
62
62
  connection_pool (~> 2.2, >= 2.2.0)
63
63
  redis (~> 3.2, >= 3.2.1)
@@ -68,11 +68,12 @@ module Reactor::Subscribable
68
68
  end
69
69
 
70
70
  def static_subscriber_namespace
71
- unless Reactor::StaticSubscribers.const_defined?(self.name, false)
72
- Reactor::StaticSubscribers.const_set(self.name, Module.new)
71
+ ns = self.name.demodulize
72
+ unless Reactor::StaticSubscribers.const_defined?(ns, false)
73
+ Reactor::StaticSubscribers.const_set(ns, Module.new)
73
74
  end
74
75
 
75
- Reactor::StaticSubscribers.const_get(self.name, false)
76
+ Reactor::StaticSubscribers.const_get(ns, false)
76
77
  end
77
78
  end
78
79
  end
@@ -1,3 +1,3 @@
1
1
  module Reactor
2
- VERSION = "0.11.0"
2
+ VERSION = "0.11.1"
3
3
  end
@@ -24,6 +24,17 @@ class Auction < ActiveRecord::Base
24
24
  end
25
25
  end
26
26
 
27
+ module MyNamespace
28
+ class MyClass
29
+ include Reactor::Subscribable
30
+ on_event :rain, :umbrella
31
+ end
32
+
33
+ def self.umbrella
34
+ puts 'get an umbrella'
35
+ end
36
+ end
37
+
27
38
  Reactor.in_test_mode do
28
39
  class TestModeAuction < ActiveRecord::Base
29
40
  on_event :test_puppy_delivered, -> (event) { "success" }
@@ -45,6 +56,10 @@ describe Reactor::Subscribable do
45
56
  expect(Reactor::SUBSCRIBERS['puppy_delivered'][0]).to eq(Reactor::StaticSubscribers::Auction::PuppyDeliveredHandler)
46
57
  expect(Reactor::SUBSCRIBERS['puppy_delivered'][1]).to eq(Reactor::StaticSubscribers::Auction::DoNothingHandler)
47
58
  end
59
+
60
+ it 'adds a static subscriber for namespaced classes' do
61
+ expect(Reactor::SUBSCRIBERS['rain'][0]).to eq(Reactor::StaticSubscribers::MyClass::RainHandler)
62
+ end
48
63
  end
49
64
 
50
65
  describe 'binding symbol of class method' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reactor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - winfred
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-03-11 00:00:00.000000000 Z
14
+ date: 2016-03-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: sidekiq