Skip to content

Instantly share code, notes, and snippets.

@thogg4
Created June 26, 2012 05:16
Show Gist options
  • Select an option

  • Save thogg4/2993475 to your computer and use it in GitHub Desktop.

Select an option

Save thogg4/2993475 to your computer and use it in GitHub Desktop.
method on the Array class exactly like map, and collect
class Array
def just_like_map
r = []
self.each do |a|
r << yield(a)
end
r
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment