Module: MerryGoRound::Utils
- Included in:
- Aggregator, Query
- Defined in:
- lib/merry_go_round/utils.rb
Class Method Summary collapse
Class Method Details
.seconds(granularity) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/merry_go_round/utils.rb', line 8 def seconds(granularity) map = { minute: 60, hour: 3600, day: 86400, week: 604800, year: 31536000 } map[granularity] end |
.window(granularity, timestamp) ⇒ Object
19 20 21 |
# File 'lib/merry_go_round/utils.rb', line 19 def window(granularity, ) .utc.send(:"all_#{granularity.to_s}") end |