From: Payton Swick Date: 2005-12-29T10:17:54+09:00 Subject: get mixin's name A somewhat weird situation. I have a module which I include in a class using Module#extend. That module defines an instance method which returns the name of the module that defined the method. Currently, I do that by hard-coding the string into the method definition, but it seems that there should really be a better way. Here's some code: irb(main):001:0> module Awesome irb(main):002:1> def who_am_i irb(main):003:2> 'Awesome' # Repeating myself, bad! irb(main):004:2> end irb(main):005:1> end => nil irb(main):006:0> class One irb(main):007:1> def initialize(what) irb(main):008:2> extend what irb(main):009:2> end irb(main):010:1> end => nil irb(main):011:0> a = One.new(Awesome) => # irb(main):012:0> a.who_am_i => "Awesome" -Payton