Skip to content

Commit

Permalink
* lib/set.rb (Set#replace): Apply a bit of optimization.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
knu committed Oct 10, 2010
1 parent 3ec721b commit 72ef219
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Sun Oct 10 18:42:23 2010 Akinori MUSHA <[email protected]>

* lib/set.rb (Set#replace): Apply a bit of optimization.

Sun Oct 10 10:20:07 2010 Nobuyoshi Nakada <[email protected]>

* configure.in (RUBY_MINGW32): canonicalize as like mswin version.
Expand Down
4 changes: 2 additions & 2 deletions lib/set.rb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ def clear
# Replaces the contents of the set with the contents of the given
# enumerable object and returns self.
def replace(enum)
if enum.class == self.class
@hash.replace(enum.instance_eval { @hash })
if enum.instance_of?(self.class)
@hash.replace(enum.instance_variable_get(:@hash))
else
clear
merge(enum)
Expand Down

0 comments on commit 72ef219

Please sign in to comment.