Class: Mach5::Benchmark
- Inherits:
-
Object
- Object
- Mach5::Benchmark
- Defined in:
- lib/mach5-tools/benchmark.rb
Instance Method Summary collapse
- #[](commit_id) ⇒ Object
- #add(commit_id, value) ⇒ Object
- #commits ⇒ Object
- #has_tag?(commit_id) ⇒ Boolean
-
#initialize(memory, tags) ⇒ Benchmark
constructor
A new instance of Benchmark.
- #tag(commit_id, tag_name) ⇒ Object
- #tagged ⇒ Object
Constructor Details
#initialize(memory, tags) ⇒ Benchmark
Returns a new instance of Benchmark.
3 4 5 6 |
# File 'lib/mach5-tools/benchmark.rb', line 3 def initialize(memory, ) @memory = memory @tags = end |
Instance Method Details
#[](commit_id) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/mach5-tools/benchmark.rb', line 8 def [](commit_id) benchmarks = @memory[commit_id] if benchmarks benchmarks else @memory[@tags[commit_id]] end end |
#add(commit_id, value) ⇒ Object
17 18 19 20 |
# File 'lib/mach5-tools/benchmark.rb', line 17 def add(commit_id, value) @memory[commit_id] ||= [] @memory[commit_id] << value end |
#commits ⇒ Object
26 27 28 |
# File 'lib/mach5-tools/benchmark.rb', line 26 def commits @memory.keys end |
#has_tag?(commit_id) ⇒ Boolean
34 35 36 |
# File 'lib/mach5-tools/benchmark.rb', line 34 def has_tag?(commit_id) @tags.invert[commit_id] end |
#tag(commit_id, tag_name) ⇒ Object
22 23 24 |
# File 'lib/mach5-tools/benchmark.rb', line 22 def tag(commit_id, tag_name) @tags[tag_name] = commit_id end |
#tagged ⇒ Object
30 31 32 |
# File 'lib/mach5-tools/benchmark.rb', line 30 def tagged @tags end |