Exception: RubyPi::AbstractMethodError

Inherits:
Error
  • Object
show all
Defined in:
lib/ruby_pi/errors.rb

Overview

Raised when a subclass does not implement a required abstract method from a base class.

Issue #14: Renamed from NotImplementedError to AbstractMethodError to avoid shadowing Ruby’s stdlib NotImplementedError < ScriptError. The stdlib class is raised by Kernel#fork on platforms that don’t support it, and shadowing it can cause confusing rescue behavior.

Instance Method Summary collapse

Constructor Details

#initialize(method_name = nil) ⇒ AbstractMethodError

Returns a new instance of AbstractMethodError.

Parameters:

  • method_name (String, Symbol) (defaults to: nil)

    the name of the unimplemented method



98
99
100
# File 'lib/ruby_pi/errors.rb', line 98

def initialize(method_name = nil)
  super(method_name ? "Subclass must implement ##{method_name}" : "Subclass must implement this method")
end