aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--timestring.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/timestring.rb b/timestring.rb
index ff4a220..3f70104 100644
--- a/timestring.rb
+++ b/timestring.rb
@@ -55,8 +55,9 @@ class TimeString
self <=> other
end
def <=>(other)
+ return -1 if other.class != TimeString
if self.date == other.date
- if self.time.class == String && other.time.class == String
+ if self.time.class == String && other.time.class == String
self.time.to_i == other.time.to_i ? self.time <=> other.time : self.time.to_i <=> other.time.to_i
elsif self.time.class == Time && other.time.class == Time
self.time <=> other.time