Sha256: 4e3773a9d1a07eaa8f3d467fd5320d72a34d5a9681fc9de0ed21f82ec47a064c

Contents?: true

Size: 478 Bytes

Versions: 1

Compression:

Stored size: 478 Bytes

Contents

module BadlyFormedResolution
  extend Tabs::Resolutionable
  extend self
end

module WellFormedResolution
  extend Tabs::Resolutionable
  extend self

  PATTERN = "%Y-%m-%d-%H-%M-%S"

  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 normalize(ts)
    Time.utc(ts.year, ts.month, ts.day, ts.hour, ts.min, ts.sec)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tabs-0.9.0 spec/support/custom_resolutions.rb