lib/chronic/numerizer.rb in chronic-0.9.0 vs lib/chronic/numerizer.rb in chronic-0.9.1

- old
+ new

@@ -35,11 +35,20 @@ ['fifth', '5'], ['sixth', '6'], ['seventh', '7'], ['eighth', '8'], ['ninth', '9'], - ['tenth', '10'] + ['tenth', '10'], + ['twelfth', '12'], + ['twentieth', '20'], + ['thirtieth', '30'], + ['fourtieth', '40'], + ['fiftieth', '50'], + ['sixtieth', '60'], + ['seventieth', '70'], + ['eightieth', '80'], + ['ninetieth', '90'] ] TEN_PREFIXES = [ ['twenty', 20], ['thirty', 30], @@ -88,10 +97,10 @@ end # hundreds, thousands, millions, etc. BIG_PREFIXES.each do |bp| - string.gsub!(/(?:<num>)?(\d*) *#{bp[0]}/i) { '<num>' + (bp[1] * $1.to_i).to_s} + string.gsub!(/(?:<num>)?(\d*) *#{bp[0]}/i) { $1.empty? ? bp[1] : '<num>' + (bp[1] * $1.to_i).to_s} andition(string) end # fractional addition # I'm not combining this with the previous block as using float addition complicates the strings \ No newline at end of file