Class: Variation::LinearChange

Inherits:
Change
  • Object
show all
Defined in:
lib/variation/changes/linear_change.rb

Instance Attribute Summary

Attributes inherited from Change

#end_value, #length

Instance Method Summary collapse

Methods inherited from Change

#==

Constructor Details

#initialize(hashed_args) ⇒ LinearChange

Pass :length and :end_value by hash. Length must be > 0.



4
5
6
# File 'lib/variation/changes/linear_change.rb', line 4

def initialize hashed_args
  super(hashed_args)
end

Instance Method Details

#transition_function(start_point) ⇒ Object



8
9
10
11
# File 'lib/variation/changes/linear_change.rb', line 8

def transition_function start_point
  end_point = [start_point[0] + length, end_value]
  LinearFunction.from_points start_point, end_point
end