This or that? Similar methods & classes in Ruby && Rails
summary
Practical differences matter: Range#cover vs include shows cover about twice as fast on small ranges and massively faster on huge ranges (include drops to ~27.7 it/s), regex choices matter too — match? avoids globals and is faster while =~ and others set Perl-like $~ globals, benchmarks run on Ruby 3.3.0, Mark IPS; monkey patching, class_eval and define_method have different boot/lookup costs; crazy eval-based method calling ends up ~281x slower, so pick the method whose semantics and side effects meet the real need.
AI-written summary · about
chapters (9)
- 0:00Method vs class differences
- 5:51Cover vs include in Ruby
- 10:48Regex matching options
- 16:06NoMethodError vs NotImplementedError
- 18:51Monkey patching vs define_method
- 21:39Ruby delegation methods
- 28:49Ways to call a method
- 33:03Worst string upcase
- 35:07Closing








