Class: HeadVersion Private

Inherits:
Version show all
Extended by:
T::Sig
Defined in:
version.rb

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.

A formula’s HEAD version.

Constant Summary

Constants inherited from Version

Version::NULL, Version::NULL_TOKEN

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Version

#<=>, create, detect, #detected_from_url?, #empty?, formula_optionally_versioned_regex, #hash, #major, #major_minor, #major_minor_patch, #minor, #null?, parse, #patch, #to_f, #to_i, #to_s

Constructor Details

#initializeHeadVersion

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.

Returns a new instance of HeadVersion.



670
671
672
673
# File 'version.rb', line 670

def initialize(*)
  super
  @commit = @version[/^HEAD-(.+)$/, 1]
end

Instance Attribute Details

#commitString? (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.

Returns:



668
669
670
# File 'version.rb', line 668

def commit
  @commit
end

Instance Method Details

#head?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.

Returns:

  • (Boolean)


686
687
688
# File 'version.rb', line 686

def head?
  true
end

#update_commit(commit) ⇒ 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.

Parameters:



676
677
678
679
680
681
682
683
# File 'version.rb', line 676

def update_commit(commit)
  @commit = commit
  @version = if commit
    "HEAD-#{commit}"
  else
    "HEAD"
  end
end