Ruby 初心者スレッド Part 50
■ このスレッドは過去ログ倉庫に格納されています
0158uy
2012/08/30(木) 02:01:13.96module_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
■ このスレッドは過去ログ倉庫に格納されています