Module: Attrable Private
- Extended by:
- T::Helpers
- Included in:
- BottleSpecification, Cask::Audit, Cask::Cask, Cask::DSL, Cask::DSL::Caveats, Cask::Installer, Debrew, Formula, FormulaInstaller, Homebrew::Cleanup, Requirement, SystemCommand
- Defined in:
- attrable.rb
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
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.
This module provides methods to define specialized attributes. Method stubs are generated by the Tapioca::Compilers::Attrables compiler.
Instance Method Summary collapse
- #attr_predicate(*attrs) ⇒ void private
- #attr_rw(*attrs) ⇒ void private
Instance Method Details
#attr_predicate(*attrs) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
14 15 16 17 18 19 20 |
# File 'attrable.rb', line 14 def attr_predicate(*attrs) attrs.each do |attr| define_method attr do instance_variable_get("@#{attr.to_s.sub(/\?$/, "")}") == true end end end |
#attr_rw(*attrs) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
23 24 25 26 27 28 29 |
# File 'attrable.rb', line 23 def attr_rw(*attrs) attrs.each do |attr| define_method attr do |val = nil| val.nil? ? instance_variable_get(:"@#{attr}") : instance_variable_set(:"@#{attr}", val) end end end |