'Getting an including classes name in the included module (Ruby)

I would like to use reflection in a module to map a class name to some data. My issue is that I can't always rely on using self.class.name in the module, since for subclasses it will give me the subclass's name. Is there a way for me to see the name of the class that is including the module?

class A
  include Mod
end

class B < A
end

module Mod
 MAP = { A: 1 }

  def map
    MAP[self.class.name.to_sym]
  end 
end

b = B.new
b.map        # => nil



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source