Class: HeadVersion

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

Constant Summary

Constants inherited from Version

Version::NULL, Version::NULL_TOKEN, Version::SCAN_PATTERN

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Version

#<=>, create, detect, #detected_from_url?, formula_optionally_versioned_regex, #hash, #null?, parse, #to_f, #to_i, #to_s

Constructor Details

#initialize(val) ⇒ HeadVersion

Returns a new instance of HeadVersion



481
482
483
484
# File 'brew/Library/Homebrew/version.rb', line 481

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

Instance Attribute Details

#commitObject (readonly)

Returns the value of attribute commit



479
480
481
# File 'brew/Library/Homebrew/version.rb', line 479

def commit
  @commit
end

Instance Method Details

#head?Boolean

Returns:

  • (Boolean)


495
496
497
# File 'brew/Library/Homebrew/version.rb', line 495

def head?
  true
end

#update_commit(commit) ⇒ Object



486
487
488
489
490
491
492
493
# File 'brew/Library/Homebrew/version.rb', line 486

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