From: Aron Griffis Date: 2004-02-25T07:45:10+09:00 Subject: instance_eval and constants Hello, I think this used to work in the past, but isn't working with recent Ruby versions (since sometime in the 1.6.x stream): class MyClass SomeConstant = 1 def MyClass.block(&block) instance_eval(&block) end end MyClass.block { puts SomeConstant } Now it says: NameError: uninitialized constant SomeConstant In order to make it work, I have to define: class MyClass def MyClass.method_missing(name) constant = name.to_s constant = constant[0..0].upcase + constant[1..-1] eval constant end end Then I can effectively use lower-case accessor functions for the constants: MyClass.block { puts someConstant } Is it possible to make it work without this crutch? Thanks, Aron