aboutsummaryrefslogtreecommitdiffstats
path: root/lib/weakref.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-18 21:19:18 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-18 21:19:18 +0000
commit7bbf2f308580f468802cd7d32c94fce1b9f1779e (patch)
tree0a680f59e70a78d60e776d7b763e618fb2fec624 /lib/weakref.rb
parent34276148c4450faa77bb298cfbe005f7c263f802 (diff)
downloadruby-7bbf2f308580f468802cd7d32c94fce1b9f1779e.tar.gz
* lib: Convert tabs to spaces for ruby files per
http://redmine.ruby-lang.org/projects/ruby/wiki/DeveloperHowto#coding-style Patch by Steve Klabnik [Ruby 1.9 - Bug #4730] Patch by Jason Dew [Ruby 1.9 - Feature #4718] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/weakref.rb')
-rw-r--r--lib/weakref.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/weakref.rb b/lib/weakref.rb
index ba39242445..10ec5ad476 100644
--- a/lib/weakref.rb
+++ b/lib/weakref.rb
@@ -3,11 +3,11 @@
# Usage:
# foo = Object.new
# foo = Object.new
-# p foo.to_s # original's class
+# p foo.to_s # original's class
# foo = WeakRef.new(foo)
-# p foo.to_s # should be same class
+# p foo.to_s # should be same class
# ObjectSpace.garbage_collect
-# p foo.to_s # should raise exception (recycled)
+# p foo.to_s # should raise exception (recycled)
require "delegate"
require 'thread'
@@ -24,16 +24,16 @@ class WeakRef < Delegator
@@mutex.synchronize {
rids = @@id_map[id]
if rids
- for rid in rids
- @@id_rev_map.delete(rid)
- end
- @@id_map.delete(id)
+ for rid in rids
+ @@id_rev_map.delete(rid)
+ end
+ @@id_map.delete(id)
end
rid = @@id_rev_map[id]
if rid
- @@id_rev_map.delete(id)
- @@id_map[rid].delete(id)
- @@id_map.delete(rid) if @@id_map[rid].empty?
+ @@id_rev_map.delete(id)
+ @@id_map[rid].delete(id)
+ @@id_map.delete(rid) if @@id_map[rid].empty?
end
}
}
@@ -71,10 +71,10 @@ end
if __FILE__ == $0
# require 'thread'
foo = Object.new
- p foo.to_s # original's class
+ p foo.to_s # original's class
foo = WeakRef.new(foo)
- p foo.to_s # should be same class
+ p foo.to_s # should be same class
ObjectSpace.garbage_collect
ObjectSpace.garbage_collect
- p foo.to_s # should raise exception (recycled)
+ p foo.to_s # should raise exception (recycled)
end