module A
  module_function
  def hoge x , y
    p :a
  end
end

module B
  module_function
  def hoge x , y
    p :b
  end
end

class C
  class << self
    attr_accessor :mod
  end
  def initialize z
    @x = z
  end
  def hoge w
    self.class.mod.method(__method__).call @x , w
  end
end
C.mod = B
c = C.new 2
c.hoge 4