peplum 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/peplum/application/services/shared_hash.rb +5 -13
- data/lib/peplum/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cf68ae5865f247eefd32f97a3171b4306fdf421a8e73df30429d4ee91c32232
|
4
|
+
data.tar.gz: d26d484ab649e0258ab2855ac81e14db8dbbb9a06509cf00a5d4b957b188ce6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18d05dda4ecd556ba03556dae0754a5c4e085cb90c9f77536abc5156147529b941a9377d3bdf9cfe2b124f0dae4a6cb403d1315190a0a9b0817ab16130c7b383
|
7
|
+
data.tar.gz: 58438b5a98f06d5353cbb4ffa5b9f65b15c7d51401a40498af6f82c9c09a4483e04b6bc78ddeda8427bab930c7402e720015c757d490494876877767c019d5a6
|
@@ -12,39 +12,31 @@ class SharedHash
|
|
12
12
|
@hash[k]
|
13
13
|
end
|
14
14
|
|
15
|
-
def set( k, v, broadcast = true
|
16
|
-
if @hash[k] == v
|
17
|
-
block.call if block_given?
|
18
|
-
return
|
19
|
-
end
|
15
|
+
def set( k, v, broadcast = true )
|
16
|
+
return if @hash[k] == v
|
20
17
|
|
21
18
|
@hash[k] = v
|
22
19
|
|
23
20
|
if broadcast
|
24
21
|
each_peer do |peer|
|
25
|
-
peer.shared_hash.set( k, v, false )
|
22
|
+
peer.shared_hash.set( k, v, false )
|
26
23
|
end
|
27
24
|
end
|
28
25
|
|
29
|
-
block.call if block_given?
|
30
26
|
nil
|
31
27
|
end
|
32
28
|
|
33
29
|
def delete( k, broadcast = true )
|
34
|
-
if !@hash.include? k
|
35
|
-
block.call if block_given?
|
36
|
-
return
|
37
|
-
end
|
30
|
+
return if !@hash.include? k
|
38
31
|
|
39
32
|
@hash.delete( k )
|
40
33
|
|
41
34
|
if broadcast
|
42
35
|
each_peer do |_, peer|
|
43
|
-
peer.shared_hash.delete( k, false )
|
36
|
+
peer.shared_hash.delete( k, false )
|
44
37
|
end
|
45
38
|
end
|
46
39
|
|
47
|
-
block.call if block_given?
|
48
40
|
nil
|
49
41
|
end
|
50
42
|
|
data/lib/peplum/version.rb
CHANGED