brew/Library/Homebrew/attrable.rb

22 lines
623 B
Ruby
Raw Normal View History

# typed: strict
# frozen_string_literal: true
# This module provides methods to define specialized attributes.
# Method stubs are generated by the {Tapioca::Compilers::Attrables} compiler.
# @note The compiler is fragile, and must be updated if the filename changes, if methods are added or removed,
# or if a method's arity changes.
module Attrable
2024-10-06 09:25:57 -07:00
extend T::Helpers
requires_ancestor { Module }
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