module Profilizer::ClassMethods

Public Instance Methods

profilize(method_name, time: true, gc: true, memory: true) click to toggle source
# File lib/profilizer.rb, line 35
def profilize(method_name, time: true, gc: true, memory: true)
  prepend_profilizer_module!
  define_profilized_method!(method_name, time: time, gc: gc, memory: memory)
  method_name
end

Private Instance Methods

define_profilized_method!(*args, **kwargs) click to toggle source
# File lib/profilizer.rb, line 50
def define_profilized_method!(*args, **kwargs)
  @_prifilizer_module.public_send __method__, self, *args, **kwargs
end
prepend_profilizer_module!() click to toggle source
# File lib/profilizer.rb, line 43
def prepend_profilizer_module!
  return if defined?(@_prifilizer_module)

  @_prifilizer_module = Module.new { extend ProfilizerModule }
  prepend @_prifilizer_module
end