module Fatboy::Helpers

Common helper functions, which are used across many classes.

Public Class Methods

all_format(time) click to toggle source

Get an array of the hour format, the day format, the month format, and the year format

# File lib/fatboy/helpers.rb, line 38
def self.all_format(time)
  [:hour_format, :day_format, :month_format, :year_format].map do |func|
    self.send(func, time)
  end
end
day_format(day) click to toggle source

Properly format the time to retrieve or set a day

# File lib/fatboy/helpers.rb, line 20
def self.day_format(day)
  day.utc.strftime(Fatboy::DAY_FORMAT_STR)
end
format_store(model_name, store_name) click to toggle source

Given a model_name and the properly formated hour, day, etc. string, give the name of the key views are stored in

# File lib/fatboy/helpers.rb, line 9
def self.format_store(model_name, store_name)
  "#{model_name}-#{store_name}"
end
hour_format(hr) click to toggle source

Properly format the time to retrieve or set an hour

# File lib/fatboy/helpers.rb, line 14
def self.hour_format(hr)
  hr.utc.strftime(Fatboy::HOUR_FORMAT_STR)
end
month_format(mth) click to toggle source

Properly format the time to retrieve or set a month

# File lib/fatboy/helpers.rb, line 26
def self.month_format(mth)
  mth.utc.strftime(Fatboy::MONTH_FORMAT_STR)
end
year_format(yr) click to toggle source

Properly format the time to retrieve or set a year

# File lib/fatboy/helpers.rb, line 32
def self.year_format(yr)
  yr.utc.strftime(Fatboy::YEAR_FORMAT_STR)
end