module ActionDispatch
  class ExceptionWrapper
    def extract_sources
      res = [];

      exception.backtrace.each do |trace|
        file, line, _ = trace.split(":")
        line_number = line.to_i
        res << {
          code: source_fragment(file, line_number),
          file: file,
          line_number: line_number
        }
      end

      res
    end
  end
end

module ActionDispatch
  class ExceptionWrapper
    def extract_sources
      exception.backtrace.map do |trace|
        file, line, _ = trace.split(":")
        line_number = line.to_i
        {
          code: source_fragment(file, line_number),
          file: file,
          line_number: line_number
        }
      end
    end
  end
end

Use map instead of each in extract_sources()
Use map instead of each in extract_sources()
