Sha256: f6fcc4180a0ccb6d7a06a4c4c3fcff4c79ab7c7429a3df4fe3982fde0a79cc06
Contents?: true
Size: 631 Bytes
Versions: 1
Compression:
Stored size: 631 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 def round_float(f) (f*100).round / 100.0 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tabs-0.8.0 | lib/tabs/helpers.rb |