Creating a class at runtime is as follows:
klass = Class.new superclass, &block Object.const_set class_name, klass
Example:
class Person def name "Jon" end end klass = Class.new Person do def name "#{super} Doe" end end Object.const_set "Employee", klass puts Employee.new.name
Now let's say that you have a module called "Company":
module Company end
How do you create an Employee class at runtime inside the Company Company module / space, so that the following gives the same result?
puts Company::Employee.new.name # prints "Jon Doe"
source share