Ruby

Ruby

Made by DeepSource

Use <= for checking inheritance instead of ancestors.include? RB-P1003

Performance
Minor

ancestors.include? can be upto 5x slower than using <= operator for checking inheritance between constants.

Bad practice

Object.ancestors.include? Class

Recommended

Object <= Class

References

  1. (<= vs ancestors.include? benchmark: fast-ruby)[https://github.com/fastruby/fast-ruby#ancestorsinclude-vs--code]