I am creating non-namespaced classes dynamically.
I have seen an example where this creation is done within the Object class:
class Object
for elem in ARRAY
sub_class = Object.const_set(elem.to_s.camelize, Class.new(SuperClass))
sub_class.class_eval do
def initialize(*args, &block)
...
super *args, &block
end
end
end
end
My Questions:
- Would you also evaluate this within the context of Object?
- Where is the difference from creating classes in global namespace?
- Any advantages or disadvantages?