Sha256: a8c0c507a7019893b47e629a0aabf7bf4b899072132df1f4490ebbb84e508e00

Contents?: true

Size: 614 Bytes

Versions: 4

Compression:

Stored size: 614 Bytes

Contents

module Mach5
  class Benchmark
    def initialize(memory, tags)
      @memory = memory
      @tags = tags
    end

    def [](commit_id)
      benchmarks = @memory[commit_id]
      if benchmarks
        benchmarks
      else
        @memory[@tags[commit_id]]
      end
    end

    def add(commit_id, value)
      @memory[commit_id] ||= []
      @memory[commit_id] << value
    end

    def tag(commit_id, tag_name)
      @tags[tag_name] = commit_id
    end

    def commits
      @memory.keys
    end

    def tagged
      @tags
    end

    def has_tag?(commit_id)
      @tags.invert[commit_id]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mach5-tools-0.3.0 lib/mach5-tools/benchmark.rb
mach5-tools-0.2.2 lib/mach5-tools/benchmark.rb
mach5-tools-0.2.1 lib/mach5-tools/benchmark.rb
mach5-tools-0.2.0 lib/mach5-tools/benchmark.rb