brew/Library/Homebrew/extend/predicable.rb

14 lines
282 B
Ruby
Raw Normal View History

2023-08-08 13:54:59 -07:00
# typed: strict
# frozen_string_literal: true
module Predicable
2023-08-08 13:54:59 -07:00
sig { params(attrs: Symbol).void }
def attr_predicate(*attrs)
attrs.each do |attr|
define_method attr do
instance_variable_get("@#{attr.to_s.sub(/\?$/, "")}") == true
end
end
end
end