adzap/timeliness — pull request #10 by Exoth (2013-08-19 07:51:07+00:00)
Title: Fix the month detection for lowercase and long abbreviated month names.

Let's try the usual case:

>> I18n.locale = :en
:en

>> "18 October 2013".to_date
Fri, 18 Oct 2013

>> "18 october 2013".to_date
Fri, 18 Oct 2013

>> "18 oct 2013".to_date
Fri, 18 Oct 2013

>> "18 Oct 2013".to_date
Fri, 18 Oct 2013

So far everything is ok. But in fact there are a lot of locales, which have lowercase and long abbreviated month names, like 'octobre' and 'oct.' in French.

>> I18n.locale = :fr
:fr

>> "18 Octobre 2013".to_date
ArgumentError: invalid date
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/bundler/gems/timeliness-9c8161f4ab08/lib/timeliness/core_ext/string.rb:12:in `new'
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/bundler/gems/timeliness-9c8161f4ab08/lib/timeliness/core_ext/string.rb:12:in `to_date'
from (irb):39
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/gems/railties-3.2.14/lib/rails/commands/console.rb:47:in `start'
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/gems/railties-3.2.14/lib/rails/commands/console.rb:8:in `start'
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/gems/railties-3.2.14/lib/rails/commands.rb:41:in `'
from /home/exoth/projects/jetradar/script/rails:6:in `require'
from /home/exoth/projects/jetradar/script/rails:6:in `'
from -e:1:in `load'
from -e:1:in `

'

>> "18 octobre 2013".to_date
ArgumentError: invalid date
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/bundler/gems/timeliness-9c8161f4ab08/lib/timeliness/core_ext/string.rb:12:in `new'
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/bundler/gems/timeliness-9c8161f4ab08/lib/timeliness/core_ext/string.rb:12:in `to_date'
from (irb):41
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/gems/railties-3.2.14/lib/rails/commands/console.rb:47:in `start'
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/gems/railties-3.2.14/lib/rails/commands/console.rb:8:in `start'
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/gems/railties-3.2.14/lib/rails/commands.rb:41:in `'
from /home/exoth/projects/jetradar/script/rails:6:in `require'
from /home/exoth/projects/jetradar/script/rails:6:in `'
from -e:1:in `load'
from -e:1:in `

'

>> "18 oct. 2013".to_date
NoMethodError: undefined method `map' for nil:NilClass
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/bundler/gems/timeliness-9c8161f4ab08/lib/timeliness/core_ext/string.rb:11:in `to_date'
from (irb):43
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/gems/railties-3.2.14/lib/rails/commands/console.rb:47:in `start'
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/gems/railties-3.2.14/lib/rails/commands/console.rb:8:in `start'
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/gems/railties-3.2.14/lib/rails/commands.rb:41:in `'
from /home/exoth/projects/jetradar/script/rails:6:in `require'
from /home/exoth/projects/jetradar/script/rails:6:in `'
from -e:1:in `load'
from -e:1:in `

'

>> "18 Oct. 2013".to_date
NoMethodError: undefined method `map' for nil:NilClass
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/bundler/gems/timeliness-9c8161f4ab08/lib/timeliness/core_ext/string.rb:11:in `to_date'
from (irb):45
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/gems/railties-3.2.14/lib/rails/commands/console.rb:47:in `start'
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/gems/railties-3.2.14/lib/rails/commands/console.rb:8:in `start'
from /home/exoth/.rvm/gems/ruby-1.9.3-p448@jetradar/gems/railties-3.2.14/lib/rails/commands.rb:41:in `'
from /home/exoth/projects/jetradar/script/rails:6:in `require'
from /home/exoth/projects/jetradar/script/rails:6:in `'
from -e:1:in `load'
from -e:1:in `

'

So that pull request fixes the month detection behavior to properly handle such situations.