diff options
author | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2010-02-22 19:55:05 +0100 |
---|---|---|
committer | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2010-02-22 19:55:05 +0100 |
commit | 74dd6f509092e294baf7650b6c1a0fd1cde4be4a (patch) | |
tree | 1e1383a77bda5c54c34fd2f5388df518cbba58a6 /timestring.rb | |
parent | 5676ca7738e2d53191493a3761cd11f14e83dbed (diff) |
sort numerical and than alphanumerical
Diffstat (limited to 'timestring.rb')
-rw-r--r-- | timestring.rb | 4 |
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 |