lib/tabs/resolutions/month.rb in tabs-0.9.1 vs lib/tabs/resolutions/month.rb in tabs-1.0.0

- old
+ new

@@ -1,13 +1,17 @@ module Tabs module Resolutions module Month - extend Tabs::Resolutionable + include Tabs::Resolutionable extend self PATTERN = "%Y-%m" + def name + :month + 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.month + end + + def to_seconds + 1.month end def add(ts, num) ts + num.months end