Sha256: ca4c1fcc12aea6cc4cb2c25a6c822722c6051f364f8649725bc73153cb9189b2
Contents?: true
Size: 481 Bytes
Versions: 1
Compression:
Stored size: 481 Bytes
Contents
module Tabs module Resolutions module Hour extend Tabs::Resolutionable extend self PATTERN = "%Y-%m-%d-%H" def serialize(timestamp) timestamp.strftime(PATTERN) end def deserialize(str) dt = DateTime.strptime(str, PATTERN) self.normalize(dt) end def from_seconds(s) s / 3600 end def normalize(ts) Time.utc(ts.year, ts.month, ts.day, ts.hour) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tabs-0.9.0 | lib/tabs/resolutions/hour.rb |