def parse_age(str)
      ord, word = str.split(/[. ]+/, 2)
      ord       = Integer(ord)
      word.gsub!(/s$/, '')

      ago = nil

      TIME_INTERVALS.each do |pair|
        mag, term = pair.first, pair.last

        if term == word
          ago = Time.at(Time.now.to_i - ord * mag)
          break
        end
      end

      if ago
        ago
      else
        raise ArgumentError, "Cannot parse '#{str}' as an age"
      end
    end
def parse_age(str)
      ord, word = str.split(/[. ]+/, 2)
      ord       = Integer(ord)
      word.gsub!(/s$/, '')

      ago = nil

      TIME_INTERVALS.each do |pair|
        mag, term = pair.first, pair.last

        if term == word
          ago = Time.at(Time.now.to_i - ord * mag)
          break
        end
      end

      if ago
        ago
      else
        raise ArgumentError, "Cannot parse '#{str}' as an age"
      end
    end
Given a natural-language English description of a time duration, return a Time in the past,
 that is the same duration from Time.now that is expressed in the string.

 @param [String] str an English time duration
 @return [Time] a Time object in the past, as described relative to now by str