Get the latest tech news

Abstract Methods and NotImplementedError in Ruby


Nithin Bekal's blog about programming - Ruby, Rails, Vim, Elixir.

Ruby’s NotImplementedError exception is often used as a placeholder in abstract classes for methods that should be implemented by subclasses. For instance, take the following case where we have a Setting base class, and a factory method that needs to know which implementation to instantiate: Not everyone in the Ruby community is convinced by static type checkers, but for more complex codebases, Sorbet is a fantastic choice.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of ruby

ruby

Photo of abstract methods

abstract methods

Photo of notimplementederror

notimplementederror

Related news:

News photo

Embed Crystal code directly in Ruby

News photo

Ruby on Rails Creator Removes TypeScript From Turbo Framework, Upsets Community