Created
November 1, 2014 02:19
-
-
Save xander-miller/8e1133abec5c61e7aec3 to your computer and use it in GitHub Desktop.
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 Array | |
def new_map | |
new_array = [] | |
each do |item| | |
new_array << yield(item) | |
end | |
new_array | |
end | |
def new_select!(&block) | |
replace( select(&block) ) | |
end | |
end | |
class String | |
def collapse | |
split.join | |
end | |
def collapse! | |
replace( collapse ) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment