Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4623

Is there a hook similar to Class#inherited that's triggered only after a Ruby class definition?

$
0
0

#inherited is called right after the class Foo statement. I want something that'll run only after the end statement that closes the class declaration.

Here's some code to exemplify what I need:

class Class  def inherited m    puts "In #inherited for #{m}"  endendclass Foo  puts "In Foo"endputs "I really wanted to have #inherited tiggered here."### Output:# In #inherited for Foo# In Foo# I really wanted to have #inherited tiggered here.

Does anything like that exist? Can it be created? Am I totally out of luck?


Viewing all articles
Browse latest Browse all 4623

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>