class ComplexityAssert::ConstantComplexityModel

computes the average of the time spent in order to predict future execution time

Public Instance Methods

analyze(timings) click to toggle source
# File lib/complexity_assert/constant_complexity_model.rb, line 6
def analyze(timings)
  sum = timings.map { |size_runtime| size_runtime[1] }.inject &:+
  @average = sum / timings.size
end
predict_run_time(input_data_size) click to toggle source
# File lib/complexity_assert/constant_complexity_model.rb, line 11
def predict_run_time(input_data_size)
  @average
end
to_s() click to toggle source
# File lib/complexity_assert/constant_complexity_model.rb, line 15
def to_s
  'O(1)'
end