Issue #8238 has been updated by mjtko (Mark Titorenko).


nagachika san

Thank you for your further diagnosis of this problem.  A method search issue certainly sounds like it warrants a High priority!  I am working around my particular instance of this problem by falling back to an include approach for now.

Cheers,

Mark.
----------------------------------------
Bug #8238: Prepending any module to DateTime causes infiinite loop when using zone-related methods
https://bugs.ruby-lang.org/issues/8238#change-38632

Author: mjtko (Mark Titorenko)
Status: Assigned
Priority: High
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 
ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0]


Prepending a Module to DateTime and then inspecting or trying to use any of the methods associated with the timezone causes what appears to be an inifinite loop.

The following code demonstrates the issue:

require 'date'
DateTime.instance_eval { prepend Module.new }
DateTime.now.offset

A cursory inspection shows that similar results (or lack of!) are yielded from #zone, #hour, #minute etc. though #year, #month and #day appear unaffected:

2.0.0p0 :001 > require 'date'
 => true
2.0.0p0 :002 > DateTime.instance_eval { prepend Module.new }
 => DateTime
2.0.0p0 :003 > d = DateTime.now; nil
 => nil
2.0.0p0 :004 > d.year
 => 2013
2.0.0p0 :005 > d.month
 => 4
2.0.0p0 :006 > d.day
 => 8
2.0.0p0 :007 > d.minute
^C



-- 
http://bugs.ruby-lang.org/