class ZTimeLabelHour
Public Class Methods
daylight_class(t)
click to toggle source
# File lib/z_time_label_hour.rb, line 12 def self.daylight_class(t) (6...18).include?(t.hour) ? 'dayTimeblock' : 'niteTimeblock' end
end_for_start( t )
click to toggle source
# File lib/z_time_label_hour.rb, line 16 def self.end_for_start( t ) floor(t) + 15.minutes end
floor(t)
click to toggle source
t is a TimeWithZone or similar
# File lib/z_time_label_hour.rb, line 21 def self.floor(t) t.change(min: (t.min / 15) * 15) end
get_timeblocks(id, t1, t2, inc)
click to toggle source
Calls superclass method
ZTimeLabel::get_timeblocks
# File lib/z_time_label_hour.rb, line 4 def self.get_timeblocks(id, t1, t2, inc) (super).each do |b| t = b.starttime b.title = t.strftime('%I:%M').sub(/^0/, '') # '%I' b.css_classes = "ZTimeHeaderHourRow #{daylight_class(t)} " end end