Back to Browse

Refactoring Ruby Gem Code & Adding Custom Errors (Let's Build a Ruby Gem, Ep 02)

453 views
Apr 27, 2021
59:40

In this episode, I refactor the `Converty.convert` method's implementation to be more resilient and support more distance units, introduce errors with helpful messages, and add the ability to convert between ounces and pounds. All of this is driven out by test-first RSpec tests. While the gem functionality is still early on and not complete, I think this episode encapsulates the development flow of expanding functionality. This episode is much more focused on writing and refactoring Ruby code than building a Ruby gem. Future episodes will return to working on and managing a gem, as well as coding more functionality. Table of contents: 00:00 - Intro 02:27 - Adding feet and inches 06:24 - Refactoring the convert method 19:48 - Adding custom errors with helpful messages 34:00 - Adding weight conversion with ounces and pounds 39:53 - Incompatible units error 56:20 - Committing with Git View the code from the episode on GitHub: https://github.com/monoso/converty/releases/tag/episode-02 Ruby version: 2.6.5 Bundler version: 2.2.16 Gem version: 3.0.6

Download

0 formats

No download links available.

Refactoring Ruby Gem Code & Adding Custom Errors (Let's Build a Ruby Gem, Ep 02) | NatokHD