#inherited
class Foo
ステートメントの直後に呼び出されます。end
クラス宣言を閉じるステートメントの後にのみ実行されるものが必要です。
必要なものを例示するコードを次に示します。
class Class
def inherited m
puts "In #inherited for #{m}"
end
end
class Foo
puts "In Foo"
end
puts "I really wanted to have #inherited tiggered here."
### Output:
# In #inherited for Foo
# In Foo
# I really wanted to have #inherited tiggered here.
そのようなものは存在しますか?作成できますか?私は完全に運が悪いのでしょうか?