Skip to content

Instantly share code, notes, and snippets.

@hugopeixoto
Created May 29, 2012 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hugopeixoto/2823972 to your computer and use it in GitHub Desktop.
Save hugopeixoto/2823972 to your computer and use it in GitHub Desktop.
Allows for iteration of multiple enumerables
Gem::Specification.new do |s|
s.name = 'enumerable_collate'
s.version = '0.1.0'
s.platform = Gem::Platform::RUBY
s.author = 'Hugo Peixoto'
s.email = 'hugo.peixoto@gmail.com'
s.summary = 'Enumerable Collate'
s.description = 'Allows for iteration of multiple enumerables'
s.files = ['enumerable_collate.rb']
s.require_path = '.'
s.add_development_dependency('rspec', ["~> 2.0"])
end
module Enumerable
def collate *other, &block
([self] + other).each { |enum| enum.each &block }
end
end
@pkoch
Copy link

pkoch commented May 30, 2012

What? No tests? :P

@hugopeixoto
Copy link
Author

Feel free to contribute :P

@pkoch
Copy link

pkoch commented Jun 3, 2012

Checkout my fork. I suppose that was the intended behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment