diff --git a/ChangeLog b/ChangeLog index ebd9702222..8edf692b7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sun Oct 10 18:42:23 2010 Akinori MUSHA + + * lib/set.rb (Set#replace): Apply a bit of optimization. + Sun Oct 10 10:20:07 2010 Nobuyoshi Nakada * configure.in (RUBY_MINGW32): canonicalize as like mswin version. diff --git a/lib/set.rb b/lib/set.rb old mode 100644 new mode 100755 index 5e4e0878bd..5655c263ba --- a/lib/set.rb +++ b/lib/set.rb @@ -130,8 +130,8 @@ class Set # 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)