Codecast: Create a RubyGem 82: Add method_missing methods to Benchmark Script @StatelessCode
Codecast: Create a RubyGem 82: Add method_missing methods to Benchmark Script  @StatelessCode
Uploaded October 2021 | Updated September 2026, 3 weeks ago
This is the 82nd video in the NerdDice create a RubyGem series. In this video Mike adds the ConvenienceMethods to the NerdDice benchmark script. Since metaprogramming is involved and performance is one of the specific common pitfalls of using method_missing, it is important to ensure that it is operating within reasonable parameters.

This video covers:
00:00:12 Introduction
00:01:58 Include ConvenienceMethods in the benchmark script
00:02:40 Add total_ ConvenienceMethods to benchmark
00:06:40 Try to adapt to use a different ratio (wrong answers only)
00:09:57 Modify label of total_ convenience methods to try and use roll_dice benchmarks (still doing it wrong)
00:14:08 Use puts statement to debug the issue and realize that the labels in x.report need to be changed
00:16:24 Give the total_ methods their own ratios use trial and error to determine values
00:18:33 Add roll_ ConvenienceMethods to benchmark
00:22:40 Add roll_3d6 ConvenienceMethods to benchmark
00:26:06 Remediate RuboCop violations, initial commit and push to GitHub
00:28:40 GitHub action: Everybody fails the first jump. Increase ratios
00:32:08 Amend commit, force push (remember to add the changes first)
00:33:18 Discussion: Was this successful? Compare with temporary version that doesn't use define_method
00:39:24 Outtake


This video is CC0 - No rights reserved. (YouTube doesn't allow this option when publishing.) All code is released under the UNLICENSE. Stateless Code denies the concept of "intellectual property". Copying is not stealing.
Codecast: Create a RubyGem 82: Add method_missing methods to Benchmark ScriptAdd Coveralls to a Rails 7 ProjectMediocre Karaoke - The Long and Winding Road by The BeatlesRails 8 Development with Dev Containers and rails-newReview a Pull Request from Our Devise Tailwind Video: Rails Helpers or Tailwind Directives?The Way of the Waveform - How I Trimmed 30 Minutes of Dead Air from a Coding Video with OpenShotInkscape 06: Rework the Stateless Code Logo and Make a Nerdy DieCodecast: Getting Started with Rails 7 22: Broadcast Comment Changes to the Article with Turbo300 Videos! 300 Badges!Create a RubyGem 96: Drop Official Support for End-of-Life Ruby 2.7Set up a Salesforce Development Environment on Ubuntu 24.04Why Do Your Own User Experience Research?
Stateless Code |

Codecast: Create a RubyGem 82: Add method_missing methods to Benchmark Script

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER