Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/time_difference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

class TimeDifference

attr_reader :time_diff
private_class_method :new

TIME_COMPONENTS = [:years, :months, :weeks, :days, :hours, :minutes, :seconds]
Expand Down Expand Up @@ -78,6 +79,10 @@ def humanize
return [diff_parts.join(', '), last_part].join(' and ')
end
end

def <=>(other)
@time_diff <=> other.time_diff
end

private

Expand Down