Skip to content

Instantly share code, notes, and snippets.

@xander-miller
Created November 1, 2014 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xander-miller/8e1133abec5c61e7aec3 to your computer and use it in GitHub Desktop.
Save xander-miller/8e1133abec5c61e7aec3 to your computer and use it in GitHub Desktop.
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