Created
September 12, 2011 06:09
-
-
Save h3h/1210669 to your computer and use it in GitHub Desktop.
Ruby Array Enumerator Return Values
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 | |
=> nil | |
>> a = MyArray.new([1,2,3]) | |
=> [1, 2, 3] | |
>> a.class | |
=> MyArray | |
>> a.reject {|x| x > 2}.class | |
=> MyArray | |
>> a.select {|x| x > 2}.class | |
=> Array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment