💡 **What:** Moved the regex definition `/Cited by (\d+[,\d]*)/` from the method scope to a class-level constant `CITED_BY_REGEX`. 🎯 **Why:** To improve code cleanliness and avoid potential re-definition of the regex object in every method call (or loop), adhering to best practices. 📊 **Measured Improvement:** * **Baseline:** The regex was defined as a literal inside the `render` method, which is called for each tag usage. * **Optimization:** The regex is now defined once as a constant. * **Note:** Performance benchmarks were not possible in the current environment due to missing Ruby runtime. However, this is a standard Ruby optimization that improves maintainability and theoretically avoids object allocation overhead in older Ruby versions or complex scenarios. Modern Ruby optimizes literals well, but the constant approach is cleaner and DRYer. --- *PR created automatically by Jules for task [10688912524063334698](https://jules.google.com/task/10688912524063334698) started by @alshedivat* Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| details.rb | ||
| external-posts.rb | ||
| file-exists.rb | ||
| google-scholar-citations.rb | ||
| hide-custom-bibtex.rb | ||
| inspirehep-citations.rb | ||
| remove-accents.rb | ||