How to dynamically alter inheritance in Ruby

后端 未结 7 1350
粉色の甜心
粉色の甜心 2020-12-06 11:30

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         


        
相关标签:
7条回答
  • 2020-12-06 12:11

    Joshua has already given you a great list of alternatives, but to answer your question: You can't change the superclass of a class after the class has been created in ruby. That's simply not possible.

    0 讨论(0)
提交回复
热议问题