You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: time_helper.rb
    path of file: ./repos/kontena/cli/lib/kontena/cli/helpers
    
    the code of the file until where you have to start completion: module Kontena::Cli::Helpers
  module TimeHelper
    # Return an approximation of how long ago the given time was.
    # @param time [String]
    # @param terse [Boolean] very terse out
    
    def time_since(time, terse: false)
      return '' if time.nil? || time.empty?

      dt = Time.now - Time.parse(time)

      dt_s = dt.to_i
      dt_m, dt_s = dt_s / 60, dt_s % 60
      dt_h, dt_m = dt_m / 60, dt_m % 60
      dt_d, dt_h = dt_h / 60, dt_h % 60

      parts = []
      parts << "%dd" % dt_d if dt_d > 0
      parts << "%dh" % dt_h if dt_h > 0
      parts << "%dm" % dt_m if dt_m > 0
      parts << "%ds" % dt_s

      if terse
        return parts.first
      else
        return parts.join('')
      end