Issue #8238 has been updated by nagachika (Tomoyuki Chikanaga).

Category set to core
Status changed from Open to Assigned
Assignee set to nobu (Nobuyoshi Nakada)
Priority changed from Normal to High

Hello, Mark
Thank you for your reporting.

I can reproduce it with trunk(r40190) and 2.0.0-dev(patchlevel 120) and wrote smaller reproducive code. It is not an issue of Date/DateTime but method search.

 class A
   def m
   end
   private :m
 end
 
 class B < A
   public :m
   prepend Module.new
 end
 
 B.new.m

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

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/