module Contour
Public Class Methods
body_background_color_select()
click to toggle source
# File lib/contour.rb, line 93 def self.body_background_color_select retrieve_option(:body_background_color) || mod_year(body_background_color) end
body_background_image_select()
click to toggle source
# File lib/contour.rb, line 97 def self.body_background_image_select() retrieve_option(:body_background_image) || mod_year(body_background_image) end
link_color_select()
click to toggle source
# File lib/contour.rb, line 89 def self.link_color_select retrieve_option(:link_color) || mod_year(link_color) end
mod_year(element)
click to toggle source
Takes a string or array as input and returns element from location (YearDay % ArraySize)
# File lib/contour.rb, line 111 def self.mod_year(element) array = [element].flatten array.size > 0 ? array[Date.today.yday % array.size] : nil end
retrieve_option(option_name)
click to toggle source
# File lib/contour.rb, line 101 def self.retrieve_option(option_name) key = Date.today.month.to_s + "-" + Date.today.day.to_s if month_day.kind_of?(Hash) and month_day[key] and not month_day[key][option_name.to_sym].blank? month_day[key][option_name.to_sym] else nil end end
setup() { |self| ... }
click to toggle source
# File lib/contour.rb, line 85 def self.setup yield self end