lib/trace_location/collector.rb in trace_location-0.12.1 vs lib/trace_location/collector.rb in trace_location-0.12.2
- old
+ new
@@ -28,10 +28,19 @@
location_cache_key = "#{caller_path}:#{caller_lineno}"
mes = extract_method_from(trace_point)
next if mes.source_location[0].match?(/\A(?:<internal:.+>|\(eval\))\z/)
- method_source = method_source_cache[mes] ||= remove_indent(mes.source)
+ method_source =
+ if method_source_cache.key?(mes)
+ method_source_cache[mes]
+ else
+ method_source_cache[mes] =
+ begin
+ remove_indent(mes.source)
+ rescue MethodSource::SourceNotFoundError
+ end
+ end
case trace_point.event
when :call
cache[location_cache_key] = hierarchy