formula: require instances to use a subclass

This commit is contained in:
Bo Anderson 2022-08-24 23:51:29 +01:00
parent 93647e5c98
commit 1c5ba1f685
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65

View File

@ -181,6 +181,9 @@ class Formula
# @private
def initialize(name, path, spec, alias_path: nil, force_bottle: false)
# Only allow instances of subclasses. The base class does not hold any spec information (URLs etc).
raise "Do not call `Formula.new' directly without a subclass." unless self.class < Formula
@name = name
@path = path
@alias_path = alias_path