module CustomWorld def self.extended(obj) obj.instance_exec{ @foo = 'bar' } end end World(CustomWorld)