module RtmEstimateConverter

Constants

VERSION

Public Instance Methods

estimated_time() click to toggle source
# File lib/rtm_estimate_converter/estimate.rb, line 2
def estimated_time
  scan(/(?:([0-9\.]+)\s*([^0-9]+|\z))/u).inject(0) {|_, (num, unit)|
    _ + num.to_f.send(time_conversion_method(unit))
  }
end

Private Instance Methods

time_conversion_method(unit) click to toggle source
# File lib/rtm_estimate_converter/estimate.rb, line 9
def time_conversion_method(unit)
  case unit[0]
  when "d"; :days
  when "h"; :hours
  when "m"; :minutes
  else raise "Can not convert!"
  end
end