class C end var = \"I am a local var outside\" C.class_eval do def self.a_class_method puts var end end
I know, this is not correct, beca
you can do it simply this way
class << C define_method(:a_class_method) do # do something end end