MiniProfiler / rack-mini-profiler

Profiler for your development and production Ruby rack apps.
MIT License
3.68k stars 400 forks source link

Refactor html and page serveing logic into modules #593

Closed technicalpickles closed 7 months ago

technicalpickles commented 8 months ago

Another attempt to try to cleanup MiniProfiler. I started trying to group similar logic together to pull out to its own module, and the ones that stood out had to do with serving an HTTP response directly (ie actions) and generating HTML for said response.

That lead me to introducing Actions and HTML modules. This is just grouping methods into logical modules and including them, so it really change much functionally. It does let you see similar methods a lot closer together.

For Actions, most of the methods were already named serve_, so I moved those to Actions. Anything else that was serving up a request directly was moved there and named as well.

I changed serve_html a little because despite the name, it does serve up other things. I hoisted those conditionals for snapshot, results, and flamegraphs out of the method to the one place where serve_html was called.