Remove caching in DeclarativePolicy framework
Summary
Refer to this comment and code
The referred Ruby bug report has now been closed. The patch was applied to Ruby 10 months ago.
# This method is heavily cached because there are a lot of anonymous
# modules in play in a typical rails app, and #name performs quite
# slowly for anonymous classes and modules.
#
# See https://bugs.ruby-lang.org/issues/11119
#
# if the above bug is resolved, this caching could likely be removed.
def class_for_class(subject_class)
Improvements
- code adds complexity to DeclarativePolicy framework
- possible performance gains?
Risks
- any changes to DeclarativePolicy framework could affect security
- there are currently no tests directly against this code
Involved components
Optional: Intended side effects
Optional: Missing test coverage
- No tests in place for DeclarativePolicy framework