Skip to content

Instantly share code, notes, and snippets.

@fresh5447
Created February 20, 2014 20:38
Show Gist options
  • Save fresh5447/9122742 to your computer and use it in GitHub Desktop.
Save fresh5447/9122742 to your computer and use it in GitHub Desktop.
class Array
def new_map
a = []
self.each do |item|
a << yield(item)
end
a
end
def new_map!(&block)
self.replace(self.new_map(&block))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment