@StatelessCode
  @StatelessCode
Stateless Code | Codecast: Create a RubyGem 66: Overview of Metaprogramming using method_missing @StatelessCode | Uploaded October 2021 | Updated October 2024, 1 hour ago.
What if I told you that we could write our code in such a way that we could dynamically allow for rolling of any number of dice, including our advantage and disadvantage methods? In our codecast today, I'm going to show you the way of Ruby metaprogramming by overriding the method_missing method. We won't be writing any code on NerdDice itself this episode. Method missing is a powerful and sharp tool that must be used responsibly in order to not break your project and maintain a reasonable level of performance. If this is your first forray into metaprogramming, I am going to free your mind. Let's see how deep the rabbit hole goes...

This is the 66th video in the NerdDice create a RubyGem series. In this video Mike provides an overview of the basics and guidelines on how to
override the method_missing method in Ruby to provide expressive, dynamic convenience methods without breaking your project or crushing your performance.

This video covers:
00:00:12 Introduction with mediocre Morpheus impersonation
00:01:11 Overview of convenience methods epic in NerdDice
00:02:12 Demonstration of default implementation of method_missing
00:02:54 Use of method_missing for metaprogramming
00:04:12 The worst version of method_missing (breaking default implementation)
00:05:28 Using super keyword to not break method_missing in your override
00:07:45 Performance considerations of method_missing
00:12:20 Using define_method and class_eval to improve performance (but make sure you use send so it works correctly the first time)
00:16:24 Interacting with arguments, keyword arguments, and blocks in method_missing and define_method
00:20:03 Review specific requirements of the NerdDice convenience methods


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 66: Overview of Metaprogramming using method_missingSet up a Salesforce Development Environment on Ubuntu 24.04Why Do Your Own User Experience Research?Codecast: statelesscode.com WordPress 03: Install WP Test Dataset and Create Theme off of Sage 10Get Rails System Tests Working with GitHub ActionsCodecast: Create a RubyGem 57: Write the harvest_totals methodCodecast: Create a RubyGem 74: Add Highest and Lowest to total_ PatternCodecast: Create a RubyGem 58: Write total_ability_scores methodCodecast: Create a RubyGem 62: Retrospective on Version 0.3.0 ReleaseMediocre Karaoke - Time of the Season by The ZombiesCelebrating 200 Stateless Code Videos!Create a RubyGem 95: Consolidate the CHANGELOG to the Master Branch

Codecast: Create a RubyGem 66: Overview of Metaprogramming using method_missing @StatelessCode

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER