lib/tailog/watch_methods.rb in tailog-0.3.6 vs lib/tailog/watch_methods.rb in tailog-0.3.7
- old
+ new
@@ -50,9 +50,24 @@
def internal_request_id
SecureRandom.uuid
end
end
+ def inject_constants targets
+ targets.each do |target|
+ begin
+ target.constantize.instance_methods(false).each do |method|
+ inject_instance_method "#{target}##{method}"
+ end
+ target.constantize.methods(false).each do |method|
+ inject_class_method "#{target}.#{method}"
+ end
+ rescue => error
+ WatchMethods.logger.error "Inject constant `#{target}' failed: #{error.class}: #{error.message}"
+ end
+ end
+ end
+
def inject_methods targets
targets.each do |target|
begin
if target.include? "#"
inject_instance_method target