From: "simeonwillbanks (Simeon Willbanks)" Date: 2013-12-07T01:32:22+09:00 Subject: [ruby-core:58916] [ruby-trunk - Feature #9190] Expose serial helper macros Issue #9190 has been updated by simeonwillbanks (Simeon Willbanks). @charliesome and @tmm1, thanks for the support, and I concur. @nobu I've hacked together a gem. It's an alpha version, and it depends upon this patch. https://github.com/simeonwillbanks/busted The gem is a continuation of the description's example. Basically, an application wraps code in a block. Once the block executes, it reports whether or not the constant or method cache was busted. The tests have specific examples. https://github.com/simeonwillbanks/busted/blob/master/test/busted_test.rb Hope this helps. If you have anymore questions, please ask. Thanks! ---------------------------------------- Feature #9190: Expose serial helper macros https://bugs.ruby-lang.org/issues/9190#change-43466 Author: simeonwillbanks (Simeon Willbanks) Status: Feedback Priority: Normal Assignee: Category: core Target version: I've defined RubyVM::InstructionHelper with singleton methods #method_serial and #constant_serial. They delegate to helper macros GET_METHOD_SERIAL() and GET_CONSTANT_SERIAL(). With these methods, users have visibility into the method and constant caches. If it makes sense, I hope this patch is included in Ruby 2.1.0. def constants_busted?(&blk) starting = RubyVM::InstructionHelper.constant_serial yield ending = RubyVM::InstructionHelper.constant_serial ending > starting end busted = constants_busted? do class Foo; end end puts busted.inspect # true https://github.com/ruby/ruby/pull/462.patch Thanks for considering; any input is appreciated! -- http://bugs.ruby-lang.org/