aboutsummaryrefslogtreecommitdiff
path: root/timestring.rb
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--timestring.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/timestring.rb b/timestring.rb
index 78168bd..387aba3 100644
--- a/timestring.rb
+++ b/timestring.rb
@@ -56,7 +56,9 @@ class TimeString
end
def <=>(other)
if self.date == other.date
- if self.time.class == String && other.time.class == String || self.time.class == Time && other.time.class == Time
+ 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
elsif self.time.class == NilClass && other.time.class == NilClass
0