Trans wrote:
> Is there a better way to do conditional class extension?
> 
>   module Foo
>     if const_get(:Bar)
       if defined? Bar

That works if you are referring literally to Bar, but not if you just 
have a variable referring to a string that might or might not be defined 
as a constant in Foo. In that case, you could use constants.include?(str).

>       class Bar
>         def x; end
>       end
>     end recue nil
>   end
> 
> The 'if const_get ... rescue nil' doesn't seem very elegant.
> 
> Thanks,
> T.
> 


-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407