Skip to content

Instantly share code, notes, and snippets.

@cheeyeo
Created April 13, 2014 16:36
Show Gist options
  • Save cheeyeo/10591454 to your computer and use it in GitHub Desktop.
Save cheeyeo/10591454 to your computer and use it in GitHub Desktop.
Date range with enumerator rather than enumerable
require 'date'
def ndays_from(from, step=7)
Enumerator.new {|y|
loop {
y.yield from
from += step
}
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment