Sha256: bc8a61ba69100836300d66df722a043b0d60f15ba4271b5645dd6b8ad6e28b46

Contents?: true

Size: 693 Bytes

Versions: 1

Compression:

Stored size: 693 Bytes

Contents

require 'colorize'

module Benches
  class Regimen
    def initialize(subject)
      @subject = subject
      @inputs = []
    end

    def add_input(input, args)
      @inputs << [input, args]
    end

    def call
      puts @subject.to_s.blue
      @inputs.each do |input|
        input_string = input.first
        args = input.last
        routine(@subject, input_string, args) ? puts("  #{input_string}".green) : puts("  #{input_string}".red)
      end
    end

    private

    def routine(instance, input, args)
      params = input.split(" ")

      result = Benches::Routine.new(instance, params[3], params[0].to_i, *args).call
      result.utime < params[7].to_f
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
benches-0.2.0 lib/benches/regimen.rb