1 2 3 4 5 6 7 8 9 10 11 12 13 14
class World def self.time_of_day hour = Time.current.hour if [2, 14].include? hour :firstlight elsif (hour >= 3 && hour < 8) || (hour >= 15 && hour < 20) :day elsif [8, 20].include? hour :twilight else :night end end end