This repository was archived by the owner on Mar 15, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 8 files changed +11
-11
lines changed Expand file tree Collapse file tree 8 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,11 @@ module Ref
6
6
#
7
7
# Example usage:
8
8
#
9
- # References ::Mock.use do
9
+ # Ref ::Mock.use do
10
10
# obj = Object.new
11
- # ref = References ::WeakReference.new(obj)
11
+ # ref = Ref ::WeakReference.new(obj)
12
12
# ref.object # obj
13
- # References ::Mock.gc(obj) # mimics the garbage collector reclaiming the referenced object
13
+ # Ref ::Mock.gc(obj) # mimics the garbage collector reclaiming the referenced object
14
14
# ref.object # nil
15
15
# end
16
16
module Mock
Original file line number Diff line number Diff line change @@ -13,13 +13,13 @@ module Ref
13
13
#
14
14
# === Example usage:
15
15
#
16
- # class MyRef < References ::WeakReference
16
+ # class MyRef < Ref ::WeakReference
17
17
# def cleanup
18
18
# # Do something...
19
19
# end
20
20
# end
21
21
#
22
- # queue = References ::ReferenceQueue.new
22
+ # queue = Ref ::ReferenceQueue.new
23
23
# ref = MyRef.new(Object.new)
24
24
# queue.monitor(ref)
25
25
# queue.shift # = nil
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ module Ref
10
10
#
11
11
# === Example usage:
12
12
#
13
- # cache = References ::SoftKeyMap.new
13
+ # cache = Ref ::SoftKeyMap.new
14
14
# obj = MyObject.find_by_whatever
15
15
# obj_info = Service.lookup_object_info(obj)
16
16
# cache[obj] = Service.lookup_object_info(obj)
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ module Ref
9
9
# === Example usage:
10
10
#
11
11
# foo = Object.new
12
- # ref = References ::SoftReference.new(foo)
12
+ # ref = Ref ::SoftReference.new(foo)
13
13
# ref.object # should be foo
14
14
# ObjectSpace.garbage_collect
15
15
# ref.object # should be foo
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ module Ref
10
10
#
11
11
# === Example usage:
12
12
#
13
- # cache = References ::SoftValueMap.new
13
+ # cache = Ref ::SoftValueMap.new
14
14
# foo = "foo"
15
15
# cache["strong"] = foo # add a value with a strong reference
16
16
# cache["soft"] = "bar" # add a value without a strong reference
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ module Ref
10
10
#
11
11
# === Example usage:
12
12
#
13
- # cache = References ::WeakKeyMap.new
13
+ # cache = Ref ::WeakKeyMap.new
14
14
# obj = MyObject.find_by_whatever
15
15
# obj_info = Service.lookup_object_info(obj)
16
16
# cache[obj] = Service.lookup_object_info(obj)
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ module Ref
6
6
# === Example usage:
7
7
#
8
8
# foo = Object.new
9
- # ref = References ::WeakReference.new(foo)
9
+ # ref = Ref ::WeakReference.new(foo)
10
10
# ref.object # should be foo
11
11
# ObjectSpace.garbage_collect
12
12
# ref.object # should be nil
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ module Ref
10
10
#
11
11
# === Example usage:
12
12
#
13
- # cache = References ::WeakValueMap.new
13
+ # cache = Ref ::WeakValueMap.new
14
14
# foo = "foo"
15
15
# cache["strong"] = foo # add a value with a strong reference
16
16
# cache["weak"] = "bar" # add a value without a strong reference
You can’t perform that action at this time.
0 commit comments