• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

モジュール内で、関係ないモジュールのクラスを定義してもいいんですね。
まぁ、やらん方がいいとは思うけど。

ruby>>
module Foo
end

module Baz
class ::Foo::Bar
def xyzzy
'hoge'
end
end
end

Foo::Bar.new.xyzzy #=> 'hoge'
<<ruby

posted by technohippy technohippy on Tue 5 Aug 2008 at 20:40 with 0 comments