From: Eric Hodel Date: 2010-12-14T03:21:39+09:00 Subject: Re: VERSION constant issue On Nov 25, 2010, at 05:54, Intransition wrote: > Ruby's VERSION constant is getting in the way of using #const_missing > in my module. Here's some example code: > > module Foo > def self.const_data > @const_data ||= { 'version' => '1.0.0' } > end > > def self.const_missing(name) > key = name.to_s.downcase > const_data[key] || super(name) > end > end > > Foo::VERSION #=> '1.8.7' > > How can I fix this? What would ::const_data provide that Module#constants, Module#const_get and Module#const_set and direct constant access don't provide? If it's something legitimate, invert ::const_data to reference real constants via introspection and get rid of const_missing. > I tried `remove_const(:VERSION)` at the toplevel but discovered that > some Ruby library don't like that (sorry, can't recall which it was > off hand). File a bug, they should be using RUBY_VERSION.