私はそれらが含まれているときに「含まれている」関数を呼び出す必要があるモジュールをいくつか持っています..この関数はそれらのすべてで同じです..したがって、この含まれている関数をモジュールを作成し、これらすべてのサブモジュールにそれを含めます..これは不自然な例ですが、次のようなものが必要です....
module Humanable
def self.extended(klass)
klass.instance_eval do
define_method :included do |base|
puts 'I was just included into the Person Class'
end
end
end
end
module Personable
extend Human
end
class Person
include Personable
end
Person に Personable が含まれている場合、Humanable モジュールから文字列を配置します。これは機能しませんが、どうすればこれを達成できるかがわかりますか?