Skip to content

Commit

Permalink
Fix a bug where IdHash#[] was still using __getobj__
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Mar 22, 2010
1 parent c94f6e6 commit d98d229
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/weakling/collections.rb
Expand Up @@ -20,7 +20,7 @@ def initialize(obj, queue)
def [](id)
_cleanup
if wr = @hash[id]
return wr.__getobj__ rescue nil
return wr.get rescue nil
end

return nil
Expand Down
4 changes: 4 additions & 0 deletions spec/idhash_spec.rb
Expand Up @@ -10,6 +10,10 @@
ary = (1..10).to_a.map {Object.new}
ids = ary.map {|o| @id_hash.add(o)}

ids.each do |id|
@id_hash[id].should_not == nil
ary.should include(@id_hash[id])
end
ids.sort.should == ary.map(&:__id__).sort
@id_hash.to_a.sort.should == ary.map{|obj| [obj.__id__, obj]}.sort
end
Expand Down

0 comments on commit d98d229

Please sign in to comment.