Class: Lemans::Bench::Revision
- Inherits:
-
Data
- Object
- Data
- Lemans::Bench::Revision
- 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
-
#commit ⇒ Object
readonly
Returns the value of attribute commit.
-
#dirty ⇒ Object
readonly
Returns the value of attribute dirty.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#commit ⇒ Object (readonly)
Returns the value of attribute commit
31 32 33 |
# File 'lib/lemans/bench.rb', line 31 def commit @commit end |
#dirty ⇒ Object (readonly)
Returns the value of attribute 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 |
.none ⇒ Object
32 |
# File 'lib/lemans/bench.rb', line 32 def self.none = new(commit: nil, dirty: nil) |
Instance Method Details
#to_h ⇒ Object
52 |
# File 'lib/lemans/bench.rb', line 52 def to_h = { commit: commit, dirty: dirty } |