Sha256: 625ab314de845b620c931079eb151252ab4c7bafcdc309d4998eeca2fcb11085
Contents?: true
Size: 559 Bytes
Versions: 3
Compression:
Stored size: 559 Bytes
Contents
# -*- coding: utf-8 -*- # class ZTimeLabelHour < ZTimeLabel 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 def self.daylight_class(t) (6...18).include?(t.hour) ? 'dayTimeblock' : 'niteTimeblock' end def self.end_for_start( t ) floor(t) + 15.minutes end # t is a TimeWithZone or similar def self.floor(t) t.change(min: (t.min / 15) * 15) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
scheduled_resource-0.0.3 | lib/z_time_label_hour.rb |
scheduled_resource-0.0.2 | lib/z_time_label_hour.rb |
scheduled_resource-0.0.1 | lib/z_time_label_hour.rb |