Class: NoSE::Measurements::Measurement

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
DescriptiveStatistics, Enumerable
Defined in:
lib/nose_cli/measurements.rb

Overview

A measurement of a single statement execution time

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(plan, name = nil, estimate = nil, weight: 1.0) ⇒ Measurement

Returns a new instance of Measurement.



21
22
23
24
25
26
27
# File 'lib/nose_cli/measurements.rb', line 21

def initialize(plan, name = nil, estimate = nil, weight: 1.0)
  @plan = plan
  @name = name || (plan && plan.name)
  @estimate = estimate
  @weight = weight
  @values = []
end

Instance Attribute Details

#estimateObject

Returns the value of attribute estimate.



11
12
13
# File 'lib/nose_cli/measurements.rb', line 11

def estimate
  @estimate
end

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/nose_cli/measurements.rb', line 12

def name
  @name
end

#planObject (readonly)

Returns the value of attribute plan.



12
13
14
# File 'lib/nose_cli/measurements.rb', line 12

def plan
  @plan
end

#weightObject (readonly)

Returns the value of attribute weight.



12
13
14
# File 'lib/nose_cli/measurements.rb', line 12

def weight
  @weight
end

Instance Method Details

#weighted_meanFixnum

The mean weighted by this measurement weight

Returns:

  • (Fixnum)


31
32
33
# File 'lib/nose_cli/measurements.rb', line 31

def weighted_mean
  @weight * mean
end