@StatelessCode
  @StatelessCode
Stateless Code | Codecast: Create a RubyGem 68: Implement the First Magic Method @StatelessCode | Uploaded October 2021 | Updated October 2024, 2 hours ago.
This is the 68th video in the NerdDice create a RubyGem series. In this video Mike writes the specs for the roll_dNN pattern and implements it so that the following requirements are met:

* roll_dNN works and rolls one die
* Method is defined on the object after magic method is called
* Keyword arguments are correctly passed to the method when delegated
* :respond_to_missing? is defined and overwritten properly

This video covers:
00:00:12 Introduction
00:01:25 Create folder and file for spec
00:02:40 Write describe and it statements
00:04:07 Write the specs for the method
00:05:48 Test out specs and make a couple of fixes
00:08:12 Start implementing method_missing override
00:11:20 Use Rubular to write and test regular expression pattern
00:14:02 Use private methods to parse the method name, use define_method and call NerdDice.roll_dice
00:18:09 Troubleshoot failing specs (specs using wrong pattern)
00:21:34 Troubleshoot issue with spec that observes method_missing (forgot to add and_call_original)
00:31:27 Review and fix RuboCop violations except for :respond_to_missing?
00:37:58 Implement specs and override for :respond_to_missing?
00:42:55 Commit and push code. Update backlog.



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 68: Implement the First Magic MethodCodecast: statelesscode.com WordPress 15: Release 1 RetrospectiveWrite System Tests for Devise Login and LogoutCodecast: statelesscode.com WordPress 02: Get the Local Dev Environment Up and RunningCodecast: statelesscode.com WordPress 05: Use Tailwind to Style the HeaderCodecast: Getting Started with Rails 7 28: Retrospective for the SeriesCodecast: statelesscode.com WordPress 25: Release Version 0.2.0 of the ThemeCodecast: Getting Started with Rails 7 18: Destroy Comments with TurboMediocre Karaoke - A Kind of Magic by QueenMediocre A Capella Cover - Foil by Weird Al YankovicUpdate to Rails 7.0.7.2 and Upgrade Other Dependencies to Clear Dependabot AlertsFix Devise Views to Work with Tailwind and Turbo

Codecast: Create a RubyGem 68: Implement the First Magic Method @StatelessCode

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER