From: Trans Date: 2006-10-09T13:25:07+09:00 Subject: Re: Conditional class extension Ross Bamford wrote: > On Mon, 2006-10-09 at 06:55 +0900, Trans wrote: > > Is there a better way to do conditional class extension? > > > > module Foo > > if const_get(:Bar) > > class Bar > > def x; end > > end > > end recue nil > > end > > > > The 'if const_get ... rescue nil' doesn't seem very elegant. > > Just a small change, but why not just ask if const_defined? ? Oh yea! :-) Thanks, T.