From: Hal Fulton Date: 2003-09-14T14:44:12+09:00 Subject: Re: Dot versus double-colon Michael Garriss wrote: > Michael Garriss wrote: > >> Hal Fulton wrote: >> >>> Even though it looks almost like recursion. Hmm, that raises >>> the question of why/how this works. >>> >>> And another issue is: One *could* write a little module that, >>> when included in a class, exposed all the class's constants in >>> this way. Within five minutes I had it "almost" working. I'll >>> bet someone in another timezone or with more caffeine could >>> have it working in three. Anyone? >>> >>> Hal >> >> >> >> >> module Dot >> def Dot.append_features( mod ) >> mod.constants.each{|c| mod.class_eval( "def self.#{c}() >> #{mod}::#{c} end" ) } >> end >> end >> > > Has to be included after all consts are defined......working on that...... constant_added might help. and fyi, I was trying to use define_method rather than eval'ing a string. wonder if the techniques are interchangeable? I'll worry about it in the morning. Hal