Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4821

Remove uses of class_eval with string arguments

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 7.1.0.rc0
    • Affects Version/s: None
    • Component/s: None

      Currently Mongoid uses class_eval with a string in a number of places. This was probably done in the days of much older Ruby versions that did not have modern class_eval/module_eval methods/semantics. The string evaluation has two issues:

      1. It is more difficult to debug, because the evaled code is in its own scope.
      2. The fact that a string is evaluated can cause problems if the variables that are expanded have unexpected contents.

      Additionally, Mongoid appears to have an implementation of delegator pattern which is also unnecessary since both Ruby standard library and ActiveSupport provide usable implementations.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: