Created
September 3, 2014 07:46
-
-
Save benhoskings/688186f4791f1bd719bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.cumulative_by_month model, column | |
tally = 0 | |
count_by_month(model, column).map do |(month, count)| | |
[month, tally += count] | |
end | |
end | |
def self.cumulative_by_month_inject model, column | |
count_by_month(model, column).tap {|pairs| | |
pairs.inject(0) do |tally,pair| | |
pair[1] = tally + pair[1] | |
end | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment