Sha256: 326e325dd8b0172104da66723ff22c7b42098dbb4b07cc91d3c7eb683ab490f1
Contents?: true
Size: 504 Bytes
Versions: 1
Compression:
Stored size: 504 Bytes
Contents
module Tabs module Resolutions module Year extend Tabs::Resolutionable extend self PATTERN = "%Y" 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.year end def add(ts, num) ts + num.years end def normalize(ts) Time.utc(ts.year) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tabs-0.9.1 | lib/tabs/resolutions/year.rb |