charkost / prosopite

:mag: Rails N+1 queries auto-detection with zero false positives / false negatives
Apache License 2.0
1.48k stars 45 forks source link

Change #scan to return the result of the block #41

Closed oskarpearson closed 2 years ago

oskarpearson commented 2 years ago

Previously Prosopite would return whatever the finish method returned. That meant if I wanted to check some code for N+1s I'd have to do this:

Prosopite.scan
something = my_code_here
Prosopite.finish

It's more useful to be able to do something like this, since it reduces the risk of forgetting a Prospite.finish

something = Prosopite.scan do
   my_code_here
end
oskarpearson commented 2 years ago

Hi @charkost Thought I'd ping you on this - let me know if you've any suggestions/issues with it. Thanks!

charkost commented 2 years ago

Nice! A README entry would be helpful too.

oskarpearson commented 2 years ago

Nice! A README entry would be helpful too.

Aha, thanks for the reminder. Done!