Sha256: 1e76a17083b08af6652ae4ffd6ba99239f58728e7c6f7127d72a6eb22587b623
Contents?: true
Size: 570 Bytes
Versions: 1
Compression:
Stored size: 570 Bytes
Contents
module Tabs module Helpers extend self def timestamp_range(period, resolution) period = normalize_period(period, resolution) dt = period.first [].tap do |arr| arr << dt while (dt = dt + 1.send(resolution)) <= period.last arr << dt.utc end end end def normalize_period(period, resolution) period_start = Tabs::Resolution.normalize(resolution, period.first.utc) period_end = Tabs::Resolution.normalize(resolution, period.last.utc) (period_start..period_end) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tabs-0.8.1 | lib/tabs/helpers.rb |