Sha256: 35c1ae77aaa8cee37e33eae4cfe75a4ce4667fa3e03de3e34e2020cadf8aa0f9
Contents?: true
Size: 557 Bytes
Versions: 1
Compression:
Stored size: 557 Bytes
Contents
module Tabs module Resolutions module Minute extend Tabs::Resolutionable extend self PATTERN = "%Y-%m-%d-%H-%M" def serialize(timestamp) timestamp.strftime(PATTERN) end def deserialize(str) dt = DateTime.strptime(str, PATTERN) self.normalize(dt) end def from_seconds(s) s / 1.minute end def add(ts, num) ts + num.minutes end def normalize(ts) Time.utc(ts.year, ts.month, ts.day, ts.hour, ts.min) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tabs-0.9.1 | lib/tabs/resolutions/minute.rb |