WTF SourceWTF

module WTF

Nested

Definitions

def self.is_it_doing?(object)

Wrap an object such that all method calls are logged to $stderr.

Implementation

def self.is_it_doing?(object)
	log_all_the_things = Module.new
	log_all_the_things.include(IsItDoing)
	
	object.methods.each do |method|
		next if method.to_s.start_with?('__')
		
		log_all_the_things.define_method(method) do |*arguments, **options, &block|
			__log__(__method__, arguments, options, block)
			
			super(*arguments, **options, &block)
		end
	end
	
	object.singleton_class.prepend(log_all_the_things)
	
	return object
end