File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -26,22 +26,25 @@ module Dereferenceable
26
26
#
27
27
# @return [Object] the current value of the object
28
28
def value
29
- mutex . synchronize do
30
- apply_deref_options ( @value )
31
- end
29
+ mutex . synchronize { apply_deref_options ( @value ) }
32
30
end
33
31
alias_method :deref , :value
34
32
35
33
protected
36
34
35
+ # Set the internal value of this object
36
+ #
37
+ # @param [Object] val the new value
38
+ def value = ( val )
39
+ mutex . synchronize { @value = val }
40
+ end
41
+
37
42
# A mutex lock used for synchronizing thread-safe operations. Methods defined
38
43
# by `Dereferenceable` are synchronized using the `Mutex` returned from this
39
44
# method. Operations performed by the including class that operate on the
40
45
# `@value` instance variable should be locked with this `Mutex`.
41
46
#
42
47
# @return [Mutex] the synchronization object
43
- #
44
- # @!visibility public
45
48
def mutex
46
49
@mutex
47
50
end
@@ -51,8 +54,6 @@ def mutex
51
54
# @note This method *must* be called from within the constructor of the including class.
52
55
#
53
56
# @see #mutex
54
- #
55
- # @!visibility public
56
57
def init_mutex
57
58
@mutex = Mutex . new
58
59
end
@@ -69,8 +70,6 @@ def init_mutex
69
70
# @option opts [String] :freeze_on_deref (false) call `#freeze` before returning the data
70
71
# @option opts [String] :copy_on_deref (nil) call the given `Proc` passing the internal value and
71
72
# returning the value returned from the proc
72
- #
73
- # @!visibility public
74
73
def set_deref_options ( opts = { } )
75
74
mutex . synchronize do
76
75
@dup_on_deref = opts [ :dup_on_deref ] || opts [ :dup ]
You can’t perform that action at this time.
0 commit comments