Skip to content

Instantly share code, notes, and snippets.

@porras
Created September 10, 2009 16:18
Show Gist options
  • Save porras/184638 to your computer and use it in GitHub Desktop.
Save porras/184638 to your computer and use it in GitHub Desktop.
def calculate_range_start_of_months
#Catacrocker obscurism
[current = range.begin.beginning_of_month].tap { |result| result << current while (current += 1.month) <= range.end }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment