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
  • 14,307
  • 21
  • 67
  • 92

1 Answers1

3
class Alpha
  def self.inherited subclass
    store lambda{
      ...
      subclass.name
    }.call
  end
end
sawa
  • 165,429
  • 45
  • 277
  • 381