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.
Constant Summary
Constants inherited from AbstractDownloadStrategy
AbstractDownloadStrategy::HOMEBREW_CONTROLLED_STRATEGIES
Instance Attribute Summary
Attributes inherited from AbstractDownloadStrategy
Instance Method Summary collapse
- #cached_location ⇒ Pathname private
- #fetch(timeout: nil) ⇒ Pathname private
- #fetched_size ⇒ Integer? private
- #initialize(url, name, version, **meta) ⇒ void constructor private
Methods inherited from AbstractDownloadStrategy
#basename, #clear_cache, expand_deferred_environment_for?, #ohai, #quiet!, #quiet?, #source_modified_time, #source_revision, #stage, #total_size
Methods included from Utils::Output::Mixin
#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_unmarked, #pretty_upgradable, #pretty_warning
Methods included from SystemCommand::Mixin
#system_command, #system_command!
Methods included from Context
current, current=, #debug?, #deferred_environment_expansion?, #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([:stale_seconds], T.nilable(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.
30 31 32 |
# File 'api/json_download.rb', line 30 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: [:stale_seconds]) end cached_location end |
#fetched_size ⇒ Integer?
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 fetched_size File.size?(cached_location) end |