From: "Mikael Høilund" Date: 2008-10-20T06:48:38+09:00 Subject: Re: Proc metaprogramming tricks? On Oct 19, 2008, at 23:40, Adam Skobi wrote: > >> class C >> def self.inherited(klass) >> klass_name = klass.name[/[^:]+$/] >> klass.to_s.split(/::/)[0...-1].inject(Object) { |const, name| >> const.const_get name >> }.send :remove_const, klass_name >> C.const_set klass_name, klass >> end >> end > >> NB: Don't do this. > > Yes! Why haven't I thought of this solution?! > Thanks for that one. > > Are the any non obvious reasons as why not to do this type of trick > (code obfuscation, maintance hell etc.)? > That, and --8<---- class Ddddd < C end Ddddd.some_method # !> NameError --8<---- Also, my roommate laughed uncontrollably the whole time I wrote that snippet. > -- > Adam Skobi > > -- a,b=%Q=Z,O^NPO\r4_PV\\PI\x15^-\x0\v=,email=%\%%%c\%115%%# Mikael Hoilund, CTO okay=%#;hmm=(0...a.size).map{|i|((a[i]-email[i]+2)%128).# of Meta.io ApS from chr}.join;!email.gsub!'o',"%c%c"%[3+?0.<<(2),?G.~@];aha=############# Denmark hmm.scan(/#{'(.)'*5}/);!puts(email[1..-12]+aha.shift.zip(*aha).join)# Ruby <3