Sha256: ae5ef2c0d148c7c0b11b7f05c1c2b7fd37d762f3e6f224d86bcf53ddad62a462

Contents?: true

Size: 406 Bytes

Versions: 6

Compression:

Stored size: 406 Bytes

Contents

module Tabs
  module Resolutions
    module Minute
      extend self

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

      def serialize(timestamp)
        timestamp.strftime(PATTERN)
      end

      def deserialize(str)
        dt = DateTime.strptime(str, PATTERN)
        self.normalize(dt)
      end

      def normalize(ts)
        Time.utc(ts.year, ts.month, ts.day, ts.hour, ts.min)
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tabs-0.5.6 lib/tabs/resolutions/minute.rb
tabs-0.5.5 lib/tabs/resolutions/minute.rb
tabs-0.5.4 lib/tabs/resolutions/minute.rb
tabs-0.5.3 lib/tabs/resolutions/minute.rb
tabs-0.5.2 lib/tabs/resolutions/minute.rb
tabs-0.5.0 lib/tabs/resolutions/minute.rb