Friday, 30 December 2011

Backwards Compatible rbconfig

My friend James Turnbull came up with this little gem the other day:

CONFIG = Object.const_get(defined?(RbConfig) ? :RbConfig : :Config)::CONFIG

The idea being that since Config is now deprecated in Ruby 1.9.3 and yet RbConfig is not available pre-1.8.5. This work-around covers both angels.

Maybe its the old Perl hacker in me, but there is something about it I really like.

No comments:

Post a Comment