Module: APIHashable Private
- Included in:
- Cask::Cask, Formula
- Defined in:
- extend/api_hashable.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.
Used to substitute common paths with generic placeholders when generating JSON for the API.
Instance Method Summary collapse
- #generated_hash! ⇒ Object private
- #generating_hash! ⇒ Object private
- #generating_hash? ⇒ Boolean private
Instance Method Details
#generated_hash! ⇒ Object
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.
20 21 22 23 24 25 26 27 28 29 |
# File 'extend/api_hashable.rb', line 20 def generated_hash! return unless # Revert monkeypatches for API generation Object.send(:remove_const, :HOMEBREW_PREFIX) Object.const_set(:HOMEBREW_PREFIX, @old_homebrew_prefix) ENV["HOME"] = @old_home @generating_hash = false end |
#generating_hash! ⇒ Object
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.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'extend/api_hashable.rb', line 6 def return if # Apply monkeypatches for API generation @old_homebrew_prefix = HOMEBREW_PREFIX @old_homebrew_cellar = HOMEBREW_CELLAR @old_home = Dir.home Object.send(:remove_const, :HOMEBREW_PREFIX) Object.const_set(:HOMEBREW_PREFIX, Pathname.new(HOMEBREW_PREFIX_PLACEHOLDER)) ENV["HOME"] = HOMEBREW_HOME_PLACEHOLDER @generating_hash = true end |
#generating_hash? ⇒ Boolean
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.
31 32 33 34 |
# File 'extend/api_hashable.rb', line 31 def @generating_hash ||= false @generating_hash == true end |