summaryrefslogtreecommitdiff
path: root/app/lib/world.rb
blob: f76741951220af753ed0c8990f8e9ecb1bbeb34d (plain)
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