Sha256: 736a348a48365a92e922e482c9187c7603f9444c2adf6f466d04157b9af9ceb4
Contents?: true
Size: 588 Bytes
Versions: 2
Compression:
Stored size: 588 Bytes
Contents
module BadlyFormedResolution include Tabs::Resolutionable extend self end module WellFormedResolution include Tabs::Resolutionable extend self PATTERN = "%Y-%m-%d-%H-%M-%S" def name :seconds 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 end def to_seconds 1 end def add(ts, num) ts + num.seconds end def normalize(ts) Time.utc(ts.year, ts.month, ts.day, ts.hour, ts.min, ts.sec) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tabs-1.0.1 | spec/support/custom_resolutions.rb |
tabs-1.0.0 | spec/support/custom_resolutions.rb |