Can I create Ruby classes within functions bodies ? I seem to be getting error which tells me its not allowed but I think it should be as classes are too objects here.
you can create classes, but you cannot assign constants from inside a method.
this example works:
class A def a b = Class.new def b.xxx "XXX" end b end end a = A.new.a p a # # p a.xxx # "XXX"