Hi

* Jérémy Lal <kapo...@melix.org> [2013-02-17 00:54]:
> I need to know if the patch you're referring to won't
> screw redmine with ruby1.8.

You're right, ruby is such a mess ... 
It can be wrapped using a DateTime.respond_to?(:parse). This will return
false for 1.8 and true for 1.9:
  % irb1.9.1       
  irb(main):001:0> require 'date'
  => true
  irb(main):002:0> DateTime.respond_to?(:parse)
  => true

  % irb1.8
  irb(main):001:0> require 'date'
  => true
  irb(main):002:0> DateTime.respond_to?(:parse)
  => true
  irb(main):003:0> 

Simply use DateTime.parse if it responds, parsedate else. It's ugly but
thats ruby.

> Is there a simple way to reproduce this bug ? As this
> stage of debian freeze, it won't be accepted unless
> it is obvious and testable.

Its easily testable within an irb console. Also the upstream uses it
(and we don't have to repeat their copy/paste errors that lead to more
than one commit). Its also obvious: replace all occurencies of parsedate
with the if/else thing or put it in a method and use it at this places.
The second makes it also easy to write unittests for it.

   Jan

Attachment: signature.asc
Description: Digital signature

Reply via email to