lib/tabs/resolutions/year.rb in tabs-0.9.1 vs lib/tabs/resolutions/year.rb in tabs-1.0.0
- old
+ new
@@ -1,13 +1,17 @@
module Tabs
module Resolutions
module Year
- extend Tabs::Resolutionable
+ include Tabs::Resolutionable
extend self
PATTERN = "%Y"
+ def name
+ :year
+ end
+
def serialize(timestamp)
timestamp.strftime(PATTERN)
end
def deserialize(str)
@@ -15,9 +19,13 @@
self.normalize(dt)
end
def from_seconds(s)
s / 1.year
+ end
+
+ def to_seconds
+ 1.year
end
def add(ts, num)
ts + num.years
end