Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

Commit 1cb5aef

Browse files
author
Brian Durand
committed
doc fixes
1 parent 72458c2 commit 1cb5aef

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ namespace :test do
8484
task :soft_reference do
8585
puts "Testing performance of soft references..."
8686
t = Time.now
87-
100000.times do |i|
87+
100000.times do
8888
Ref::SoftReference.new(Object.new)
8989
end
9090
GC.start

lib/ref.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module Ref
2626
# IronRuby has it's own implementation of weak references.
2727
autoload :WeakReference, File.join(File.dirname(__FILE__), "ref", "weak_reference", "iron_ruby.rb")
2828
elsif defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
29-
# If using Rubinius set the implementation to use WeakRef since it is very efficient.
29+
# If using Rubinius set the implementation to use WeakRef since it is very efficient and using finalizers is not.
3030
autoload :WeakReference, File.join(File.dirname(__FILE__), "ref", "weak_reference", "weak_ref.rb")
3131
elsif defined?(ObjectSpace._id2ref)
3232
# If ObjectSpace can lookup objects from their object_id, then use the pure ruby implementation.

test/weak_reference_test.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
class TestWeakReference < Test::Unit::TestCase
55
def test_can_get_non_garbage_collected_objects
66
obj = Object.new
7-
ref = Ref::WeakReference.new(obj)
8-
assert_equal obj, ref.object
9-
assert_equal obj.object_id, ref.referenced_object_id
7+
ref_1 = Ref::WeakReference.new(obj)
8+
ref_2 = Ref::WeakReference.new(obj)
9+
assert_equal obj, ref_1.object
10+
assert_equal obj.object_id, ref_1.referenced_object_id
11+
assert_equal obj, ref_2.object
12+
assert_equal obj.object_id, ref_2.referenced_object_id
1013
end
1114

1215
def test_get_the_correct_object

0 commit comments

Comments
 (0)