47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/loggun/helpers.rb', line 47
def method_added(method_name)
super
@log_modified_methods ||= []
return if !log_all_methods && !log_only_methods&.include?(method_name)
return if log_skip_methods&.include?(method_name)
return if SKIPPED_METHODS.include?(method_name) || log_modified_methods.include?(method_name)
log_modified_methods << method_name
method = instance_method(method_name)
undef_method(method_name)
define_method(method_name) do |*args, &block|
if self.class.log_transaction_except&.include?(method_name.to_sym)
method.bind(self).call(*args, &block)
else
type = log_type(nil, method_name)
in_log_transaction(type) do
method.bind(self).call(*args, &block)
end
end
end
end
|