Sha256: c552c26e079e21d86adb76969ffb295f40442fe9d17ab145326ce0d37e76ca73

Contents?: true

Size: 357 Bytes

Versions: 6

Compression:

Stored size: 357 Bytes

Contents

module Tabs
  module Resolutions
    module Year
      extend self

      PATTERN = "%Y"

      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)
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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