C
Clifford Heath
Why doesn't the following code work?
class Foo
def Foo.const_missing(sym)
p sym
sym.to_s
end
end
Foo.new.instance_eval {
Bar
}
I thought the missing constant Bar would be caught
by the const_missing, since it's available on the
class whose instance is being instance_eval'd.
What gives? I'm writing a DSL and want to catch missing
constants within a block being instance_eval'd
Clifford Heath.
class Foo
def Foo.const_missing(sym)
p sym
sym.to_s
end
end
Foo.new.instance_eval {
Bar
}
I thought the missing constant Bar would be caught
by the const_missing, since it's available on the
class whose instance is being instance_eval'd.
What gives? I'm writing a DSL and want to catch missing
constants within a block being instance_eval'd
Clifford Heath.