0

I want to get class name of the class that has extended a class. That sentence probably doesn't make much sense, so I'll explain in code.

class Alpha
  store lambda{
    # Is it possible to reference
    # Beta somehow? I need to get
    # the classname of the extendee,
    # if that's even a real word.

    # Returns Alpha, I need Beta.
    self.name
  }.call
end

class Beta < Alpha; end

Any ideas?

daryl
  • 13,529
  • 20
  • 66
  • 90

1 Answers1

3
class Alpha
  def self.inherited subclass
    store lambda{
      ...
      subclass.name
    }.call
  end
end
sawa
  • 160,959
  • 41
  • 265
  • 366