module TabsTabs::Resolutions::Day

Constants

PATTERN

Public Instance Methods

add(ts, num) click to toggle source
# File lib/tabs_tabs/resolutions/day.rb, line 30
def add(ts, num)
  ts + num.days
end
deserialize(str) click to toggle source
# File lib/tabs_tabs/resolutions/day.rb, line 17
def deserialize(str)
  dt = DateTime.strptime(str, PATTERN)
  self.normalize(dt)
end
from_seconds(s) click to toggle source
# File lib/tabs_tabs/resolutions/day.rb, line 22
def from_seconds(s)
  s / 1.day
end
name() click to toggle source
# File lib/tabs_tabs/resolutions/day.rb, line 9
def name
  :day
end
normalize(ts) click to toggle source
# File lib/tabs_tabs/resolutions/day.rb, line 34
def normalize(ts)
  Time.utc(ts.year, ts.month, ts.day)
end
serialize(timestamp) click to toggle source
# File lib/tabs_tabs/resolutions/day.rb, line 13
def serialize(timestamp)
  timestamp.strftime(PATTERN)
end
to_seconds() click to toggle source
# File lib/tabs_tabs/resolutions/day.rb, line 26
def to_seconds
  1.day
end