Exception: Tempo::EndTimeError
- Inherits:
-
ArgumentError
- Object
- ArgumentError
- Tempo::EndTimeError
- Defined in:
- lib/tempo/exceptions.rb
Overview
Raise when the end time is less than the start time start_time and end_time should be Time objects
Instance Method Summary collapse
-
#initialize(start_time, end_time) ⇒ EndTimeError
constructor
A new instance of EndTimeError.
- #to_s ⇒ Object
Constructor Details
#initialize(start_time, end_time) ⇒ EndTimeError
Returns a new instance of EndTimeError.
48 49 50 51 52 53 54 |
# File 'lib/tempo/exceptions.rb', line 48 def initialize(start_time, end_time) @start_time = (start_time.kind_of? Time) ? start_time.strftime('%H:%M') : start_time.to_s @end_time = (end_time.kind_of? Time) ? end_time.strftime('%H:%M') : end_time.to_s @on_day = (start_time.kind_of? Time) ? "on #{start_time.strftime('%b %d, %Y')}" : "" @message = "End time #{@end_time} must be greater than start time #{@start_time} #{@on_day}" end |
Instance Method Details
#to_s ⇒ Object
56 57 58 |
# File 'lib/tempo/exceptions.rb', line 56 def to_s @message end |