Technically, @ndn is correct, it can be called after class evaluation. However, it looks like you want to verify that the configure method was called at some point in the definition of the class body (this will also enable any modules to complete the evaluation, so if the configure method calls are included in the module, all this is good).
The closest solution I found to solve this problem can be found here:
https://github.com/jasonayre/trax_core/blob/master/lib/trax/core/abstract_methods.rb
The above code is an implementation of abstract methods for ruby, which is technically not what you are asking for (you are talking about calling a method, abstract methods are about verifying that the subclass defined it), but the same trick I used there can be applied.
Basically, I use the ruby ββtrace points library to see how the end of the class definition will work out, after which it fires an event, I check if this method has been defined, and throw an error if not. So while you call configure from WITHIN of your classes, a similar solution may work for you. Something like (not verified):
module MustConfigure extend ::ActiveSupport::Concern module ClassMethods def inherited(subklass) super(subklass) subklass.class_attribute :_configured_was_called subklass._configured_was_called = false trace = ::TracePoint.new(:end) do |tracepoint| if tracepoint.self == subklass
Or you can try using the InheritanceHooks module from my library and skip manual checkpoint processing:
class BaseClass include::Trax::Core::InheritanceHooks after_inherited do raise NotImplementedError unless self._configure_was_called end end
Note that although I am using this template in production at the moment, and everything works fine on MRI, because tracing is a library created for debugging, there are some limitations when using jruby. (right now it breaks if you do not pass the jruby debug flag) - I again opened the problem, trying to get the added trace point without having to explicitly debug it.
https://github.com/jruby/jruby/issues/3096