Class: HeadVersion Private

Inherits:
Version show all
Defined in:
Library/Homebrew/version.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of HeadVersion.


566
567
568
569
# File 'Library/Homebrew/version.rb', line 566

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

Instance Attribute Details

#commitObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


564
565
566
# File 'Library/Homebrew/version.rb', line 564

def commit
  @commit
end

Instance Method Details

#head?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

580
581
582
# File 'Library/Homebrew/version.rb', line 580

def head?
  true
end

#update_commit(commit) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


571
572
573
574
575
576
577
578
# File 'Library/Homebrew/version.rb', line 571

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