class SlowDown::Strategy::Base
Attributes
max[R]
n[R]
Public Class Methods
new(n, max)
click to toggle source
# File lib/slow_down/strategy/base.rb, line 8 def initialize(n, max) # rubocop:disable Naming/MethodParameterName @n = n @max = max end
Public Instance Methods
normalized_series()
click to toggle source
# File lib/slow_down/strategy/base.rb, line 17 def normalized_series sum = series.inject(:+) ratio = max.to_f / sum series.map { |el| el * ratio } end
series()
click to toggle source
# File lib/slow_down/strategy/base.rb, line 13 def series raise NotImplemented end