Sha256: 493b1d4852fb8b4b255cab62a9e0e7e80a9f6b5c382f493dfb3a68feb8f5f9e0
Contents?: true
Size: 610 Bytes
Versions: 2
Compression:
Stored size: 610 Bytes
Contents
module Tabs module Resolutions module Month include Tabs::Resolutionable extend self PATTERN = "%Y-%m" def name :month 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.month end def to_seconds 1.month end def add(ts, num) ts + num.months end def normalize(ts) Time.utc(ts.year, ts.month) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tabs-1.0.1 | lib/tabs/resolutions/month.rb |
tabs-1.0.0 | lib/tabs/resolutions/month.rb |