Class: Homebrew::API::JSONDownloadStrategy Private
- Inherits:
-
AbstractDownloadStrategy
- Object
- AbstractDownloadStrategy
- Homebrew::API::JSONDownloadStrategy
- Defined in:
- api/json_download.rb
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Instance Attribute Summary
Attributes inherited from AbstractDownloadStrategy
Instance Method Summary collapse
- #cached_location ⇒ Pathname private
- #fetch(timeout: nil) ⇒ Pathname private
- #initialize(url, name, version, **meta) ⇒ void constructor private
Methods inherited from AbstractDownloadStrategy
#basename, #clear_cache, #quiet!, #quiet?, #source_modified_time, #stage
Methods included from SystemCommand::Mixin
#system_command, #system_command!
Methods included from Context
current, current=, #debug?, #quiet?, #verbose?, #with_context
Constructor Details
#initialize(url, name, version, **meta) ⇒ 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.
10 11 12 13 14 |
# File 'api/json_download.rb', line 10 def initialize(url, name, version, **) super @target = T.let(.fetch(:target), Pathname) @stale_seconds = T.let(.fetch(:stale_seconds), Integer) end |
Instance Method Details
#cached_location ⇒ Pathname
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.
25 26 27 |
# File 'api/json_download.rb', line 25 def cached_location .fetch(:target) end |
#fetch(timeout: nil) ⇒ Pathname
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.
17 18 19 20 21 22 |
# File 'api/json_download.rb', line 17 def fetch(timeout: nil) with_context quiet: quiet? do Homebrew::API.fetch_json_api_file(url, target: cached_location, stale_seconds: .fetch(:stale_seconds)) end cached_location end |