mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-09 14:12:37 +01:00
use a null object like a boss
This commit is contained in:
parent
55e2f5b6a1
commit
0a5936fecf
2 changed files with 14 additions and 11 deletions
7
app/models/null_time.rb
Normal file
7
app/models/null_time.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
class NullTime
|
||||
include Comparable
|
||||
|
||||
def <=>(another)
|
||||
-1 # any other Time object is always greater
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue