I was using “class Foo < foo … end” where “foo” is some arbitrary
expression, not necessarily a constant. I found that when "foo"
raises an error the result is quite (IMHO) misleading. For example:
irb(main):001:0> def foo ; raise “foo” end
=> nil
irb(main):002:0> Class.new(foo)
RuntimeError: foo
from (irb):1:in `foo’
from (irb):2
irb(main):003:0> class Foo < foo ; end
TypeError: superclass undefined
from (irb):1
irb(main):004:0>
“superclass undefined”? What happened to the real error? If Ruby had
reported the original error properly it would have saved me a certain
amount of frustration. Surely the error should simply propagate to
top level, just as when calling Class.new(foo) ?
"superclass undefined"? What happened to the real error? If Ruby had
reported the original error properly it would have saved me a certain
amount of frustration. Surely the error should simply propagate to
top level, just as when calling Class.new(foo) ?