Class: HeadVersion

Inherits:
Version show all
Defined in:
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?, #hash, #null?, parse, #to_f, #to_i, #to_s

Constructor Details

#initialize(val) ⇒ HeadVersion

Returns a new instance of HeadVersion



475
476
477
478
# File 'Library/Homebrew/version.rb', line 475

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

Instance Attribute Details

#commitObject (readonly)

Returns the value of attribute commit



473
474
475
# File 'Library/Homebrew/version.rb', line 473

def commit
  @commit
end

Instance Method Details

#head?Boolean

Returns:

  • (Boolean)


489
490
491
# File 'Library/Homebrew/version.rb', line 489

def head?
  true
end

#update_commit(commit) ⇒ Object



480
481
482
483
484
485
486
487
# File 'Library/Homebrew/version.rb', line 480

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