culpa 1.2.1 → 1.2.2
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 +8 -8
- data/lib/culpa/envelope.rb +12 -7
- data/lib/culpa.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjFmMTY1NWFhMzZlNWUwYTkyY2RiMTlkNzlhYzQ5ZjE4ZmE1Y2VlMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTljODA2YWVlMTM5ZDc5YTY0NDM0NTQyNTYzMjFkNzc4MDQ2MTg3NA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2EzMmMwYWI2M2E0NTFhNTcyOTFiMjRkZjllYzY5OTg0ZjJiMzRjNDdjZmE0
|
10
|
+
YjQ5MjViOGZmY2RhNGJhNjhiNzhmNWViNDRmODNiM2JhZDE3ZTYzM2JiZmE0
|
11
|
+
MjgwNmJkMWJiZGRhMWZiMTE5M2I1MmViY2JmMjVkZWQ0MTE3MzI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjJiOTE3ZWU4M2JjNDYzZDdhZDZjYjM4ZDZkNjM0YTQ0Y2VlY2Q1MTgzYmE4
|
14
|
+
MjdjZjI1ZWEzYmUzMjI4ZGQ2OTNkNzVjZmE4M2I1ZTQwOThmNzQzNDJjZGVm
|
15
|
+
ZTE0ZDY0MGE0NTMyNmEwYWE1N2VkNGVmZWExYWMwODA1MWEwNTc=
|
data/lib/culpa/envelope.rb
CHANGED
@@ -11,6 +11,7 @@ module Culpa
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def initialize(attributes = {})
|
14
|
+
@semaphore = Mutex.new
|
14
15
|
attributes.each do |name, value|
|
15
16
|
instance_variable_set "@#{name}", value
|
16
17
|
end
|
@@ -18,19 +19,23 @@ module Culpa
|
|
18
19
|
|
19
20
|
def method_missing(sym, *args)
|
20
21
|
sym = sym.to_s
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
@semaphore.synchronize {
|
23
|
+
if sym.end_with? '='
|
24
|
+
instance_variable_set "@#{sym.gsub('=','')}", args[0]
|
25
|
+
else
|
26
|
+
return instance_variable_get "@#{sym.gsub('=','')}"
|
27
|
+
end
|
28
|
+
}
|
26
29
|
end
|
27
30
|
|
28
31
|
def ==(other_envelope)
|
29
32
|
return false unless other_envelope.is_a? Envelope
|
30
33
|
return false unless other_envelope.instance_variables.count == instance_variables.count
|
31
|
-
instance_variables.
|
34
|
+
instance_variables.select{ |iv|
|
35
|
+
iv != :@semaphore
|
36
|
+
}.each { |iv|
|
32
37
|
return false unless instance_variable_get(iv) == other_envelope.instance_variable_get(iv)
|
33
|
-
|
38
|
+
}
|
34
39
|
return true
|
35
40
|
end
|
36
41
|
|
data/lib/culpa.rb
CHANGED