The logic for future gap and past gap seem to be very similar. Is there a way to reuse the logic between them? 

Maybe something like 

    if diff < 0
       suffix = " ago"
       diff = -diff
    else
       suffix = ""
    end

    if ....
       "#{...}h#{suffix}