I would like to dynamically specify the parent class for a class in Ruby. Consider this code:
class Agent
def self.hook_up(calling_class, desired_parent_c
Look at this
class MyClass < inherit_orm("Adapter")
end
And the class selector:
def inherit_orm(model="Activity", orm=nil)
orm = Config.orm || orm
require "orm/#{orm.to_s}"
"ORM::#{orm.to_s.classify}::#{model}".constantize
end
So, when instance MyClass it will be inherit from a dynamic class depending of orm and model.
Be sure to define both in a module. It work fine in public_activity gem ( selector example ).
I hope to help.. Bye!