lib/active_object/kernel.rb in active_object-5.8.1 vs lib/active_object/kernel.rb in active_object-5.8.2

- old
+ new

@@ -22,11 +22,14 @@ # rubocop:enable Security/Eval private # rubocop:disable Style/PerlBackrefs - def caller_name - caller(1..1).first =~ CALLER_METHOD_REGEX && $1 + def caller_name(depth = 0) + val = caller[depth][CALLER_METHOD_REGEX, 1] + return val if depth.zero? || !val.include?('<top (required)>') + + caller[depth - 1][CALLER_METHOD_REGEX, 1] end # rubocop:enable Style/PerlBackrefs end end