Sha256: 5f0a9a8f1bd062bfa9c44020cf019c4ebbc7247e43f352103ecd912e6daa0ba7
Contents?: true
Size: 592 Bytes
Versions: 2
Compression:
Stored size: 592 Bytes
Contents
module Tabs module Resolutions module Year include Tabs::Resolutionable extend self PATTERN = "%Y" def name :year end 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 to_seconds 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tabs-1.0.1 | lib/tabs/resolutions/year.rb |
tabs-1.0.0 | lib/tabs/resolutions/year.rb |