pub-sub 0.0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pub_sub/hash.rb +8 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ba7ce73cf0a207a83460614b4b53232f154f3b72a869c9511ad818cecfffa06
4
- data.tar.gz: 13f2c58178f4820477279f27860167ec67f6b2dd0c426ad2649066990a824d8c
3
+ metadata.gz: c40743db194975eb5a6157d9818dda65ecadbddef131c9b4048d61a26567ae67
4
+ data.tar.gz: 98e1db527cc5a8ddc442026857922afa800949da0054b5e53f1e7c6dfc71d0a6
5
5
  SHA512:
6
- metadata.gz: 7065628d70ee6e082e042369de6e220e950bbae0c3b1c209b42e8a4420371cea1787fd9fc4526e457dd6b3512abe56e1fe4a84914590c967fb8ae47181a20672
7
- data.tar.gz: 539ccda4ef0683b3535781b5ca0826d891be979c087d1fea6156d779a7dd516f2c13a2db26c30515594629a213221fdc88be31623aaa12c2386f6fd53930212e
6
+ metadata.gz: 1342d94d8e4333fe598cf6419183ae4528be0aa9e4fe6f9bf1faf058f3a0409169be9585e6b93048c2460290cf32c1c0b9f4cd9090dda68bdc8450d1fcd65c81
7
+ data.tar.gz: 0f1b05c15ac460f40413a8530f44c87a0d44b1b2b277596d506f05632fcc1f275e83bace387b66f527ac0ea502c2b57d08f9db1da370f3056bb1e6c776949a6c
data/lib/pub_sub/hash.rb CHANGED
@@ -1,13 +1,14 @@
1
1
  # frozen_string_literal: true
2
+ require "request_store"
2
3
 
3
4
  module PubSub
4
5
  class Hash < Container
5
6
  def initialize
6
- @container = {}
7
+ RequestStore.store[:hash] = {}
7
8
  end
8
9
 
9
10
  def pub(event, args={})
10
- iterable_subscriber_list = @container[event]
11
+ iterable_subscriber_list = RequestStore.store[:hash][event]
11
12
  return false unless iterable_subscriber_list
12
13
 
13
14
  clazzes = retrieve_klasses(iterable_subscriber_list)
@@ -18,8 +19,8 @@ module PubSub
18
19
  mutex = Mutex.new
19
20
 
20
21
  mutex.synchronize do
21
- @container[event] = [] unless @container[event]
22
- @container[event] << klazz_name unless @container[event].include?(klazz_name)
22
+ RequestStore.store[:hash][event] = [] unless RequestStore.store[:hash][event]
23
+ RequestStore.store[:hash][event] << klazz_name unless RequestStore.store[:hash][event].include?(klazz_name)
23
24
  end
24
25
  true
25
26
  end
@@ -28,9 +29,9 @@ module PubSub
28
29
  mutex = Mutex.new
29
30
 
30
31
  mutex.synchronize do
31
- return false unless @container[event]
32
-
33
- @container[event].delete(klazz_name)
32
+ return false unless RequestStore.store[:hash][event]
33
+
34
+ RequestStore.store[:hash][event].delete(klazz_name)
34
35
  true
35
36
  end
36
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pub-sub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Saltykov