Class: Homebrew::BumpVersionParser Private
Overview
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.
Class handling architecture-specific version information.
Constant Summary collapse
- VERSION_SYMBOLS =
          
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
 [:general, :arm, :intel].freeze
Instance Attribute Summary collapse
- #arm ⇒ Version, ... readonly private
 - #general ⇒ Version, ... readonly private
 - #intel ⇒ Version, ... readonly private
 
Instance Method Summary collapse
- #blank? ⇒ Boolean private
 - #initialize(general: nil, arm: nil, intel: nil) ⇒ void constructor private
 - #parse_cask_version(version) ⇒ Cask::DSL::Version? private
 - #parse_version(version) ⇒ Version, ... private
 
Constructor Details
#initialize(general: nil, arm: nil, intel: nil) ⇒ 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.
      17 18 19 20 21 22 23 24 25 26  | 
    
      # File 'bump_version_parser.rb', line 17 def initialize(general: nil, arm: nil, intel: nil) @general = T.let(parse_version(general), T.nilable(T.any(Version, Cask::DSL::Version))) if general.present? @arm = T.let(parse_version(arm), T.nilable(T.any(Version, Cask::DSL::Version))) if arm.present? @intel = T.let(parse_version(intel), T.nilable(T.any(Version, Cask::DSL::Version))) if intel.present? return if @general.present? raise UsageError, "`--version` must not be empty." if arm.blank? && intel.blank? raise UsageError, "`--version-arm` must not be empty." if arm.blank? raise UsageError, "`--version-intel` must not be empty." if intel.blank? end  | 
  
Instance Attribute Details
#arm ⇒ Version, ... (readonly)
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  | 
    
      # File 'bump_version_parser.rb', line 10 def arm @arm end  | 
  
#general ⇒ Version, ... (readonly)
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  | 
    
      # File 'bump_version_parser.rb', line 10 def general @general end  | 
  
#intel ⇒ Version, ... (readonly)
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  | 
    
      # File 'bump_version_parser.rb', line 10 def intel @intel end  | 
  
Instance Method Details
#blank? ⇒ 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.
      50 51 52  | 
    
      # File 'bump_version_parser.rb', line 50 def blank? @general.blank? && @arm.blank? && @intel.blank? end  | 
  
#parse_cask_version(version) ⇒ Cask::DSL::Version?
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.
      41 42 43 44 45 46 47  | 
    
      # File 'bump_version_parser.rb', line 41 def parse_cask_version(version) if version == "latest" Cask::DSL::Version.new(:latest) else Cask::DSL::Version.new(version) end end  | 
  
#parse_version(version) ⇒ Version, ...
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.
      32 33 34 35 36 37 38  | 
    
      # File 'bump_version_parser.rb', line 32 def parse_version(version) if version.is_a?(Version) version elsif version.is_a?(String) parse_cask_version(version) end end  |