Created
December 1, 2011 11:15
-
-
Save kommen/1415940 to your computer and use it in GitHub Desktop.
Ruby Array inheritance change
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyArray < ::Array | |
end | |
a = MyArray.new | |
puts a.class | |
puts a.reverse.class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby -v | |
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0] | |
$ ruby array_test.rb | |
MyArray | |
Array | |
$ ruby -v | |
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0] | |
$ ruby array_test.rb | |
MyArray | |
MyArray | |
$ ruby -v | |
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin11.2.0] | |
$ ruby array_test.rb | |
MyArray | |
MyArray | |
$ ruby -v | |
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin11.2.0] | |
$ ruby array_test.rb | |
MyArray | |
MyArray | |
$ ruby -v | |
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0] | |
$ ruby array_test.rb | |
MyArray | |
MyArray |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This change was intentional and isn't a bug:
https://github.com/rubyspec/rubyspec/blob/master/core/array/reverse_spec.rb#L18-28