Module: OCTranspo::ServiceDate

Included in:
OCTranspo
Defined in:
lib/octranspo/service_date.rb

Instance Method Summary collapse

Instance Method Details

#service_dateObject



4
5
6
# File 'lib/octranspo/service_date.rb', line 4

def service_date
  service_date_for Time.current
end

#service_date_for(time) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/octranspo/service_date.rb', line 8

def service_date_for (time)
  case time.hour
  when 0..3
    time.yesterday.to_date
  else
    time.to_date
  end
end