Class: Lemans::Bench::Revision

Inherits:
Data
  • Object
show all
Defined in:
lib/lemans/bench.rb

Overview

Which revision of a bench produced a score. Dirty is recorded rather than refused; a bench that is not a git checkout records nothing.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commitObject (readonly)

Returns the value of attribute commit

Returns:

  • (Object)

    the current value of commit



31
32
33
# File 'lib/lemans/bench.rb', line 31

def commit
  @commit
end

#dirtyObject (readonly)

Returns the value of attribute dirty

Returns:

  • (Object)

    the current value of dirty



31
32
33
# File 'lib/lemans/bench.rb', line 31

def dirty
  @dirty
end

Class Method Details

.detect(dir) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/lemans/bench.rb', line 34

def self.detect(dir)
  commit = git("rev-parse", "HEAD", dir: dir)
  return none if commit.nil?

  status = git("status", "--porcelain", dir: dir)
  new(commit: commit, dirty: status.nil? ? nil : !status.empty?)
end

.noneObject



32
# File 'lib/lemans/bench.rb', line 32

def self.none = new(commit: nil, dirty: nil)

Instance Method Details

#to_hObject



52
# File 'lib/lemans/bench.rb', line 52

def to_h = { commit: commit, dirty: dirty }