Exception: Tempo::DifferentDaysError

Inherits:
ArgumentError
  • Object
show all
Defined in:
lib/tempo/exceptions.rb

Instance Method Summary collapse

Constructor Details

#initialize(start_time, end_time) ⇒ DifferentDaysError

Returns a new instance of DifferentDaysError.



63
64
65
66
67
# File 'lib/tempo/exceptions.rb', line 63

def initialize(start_time, end_time)
  @start_time = (start_time.kind_of? Time) ? start_time.strftime('%H:%M on %b %d, %Y') : start_time.to_s
  @end_time = (end_time.kind_of? Time) ? end_time.strftime('%H:%M on %b %d, %Y') : end_time.to_s
  @message = "End time must be on the same day as start time: #{start_time} : #{end_time}"
end

Instance Method Details

#to_sObject



69
70
71
# File 'lib/tempo/exceptions.rb', line 69

def to_s
  @message
end