Class: InterpolationAlgorithm
- Inherits:
-
Object
- Object
- InterpolationAlgorithm
- Defined in:
- lib/polynomial_ruby/interpolation_algorithm.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#points ⇒ Object
Returns the value of attribute points.
-
#values ⇒ Object
Returns the value of attribute values.
Instance Method Summary collapse
- #call(point) ⇒ Object
-
#initialize(input) ⇒ InterpolationAlgorithm
constructor
A new instance of InterpolationAlgorithm.
Constructor Details
#initialize(input) ⇒ InterpolationAlgorithm
Returns a new instance of InterpolationAlgorithm.
4 5 6 7 |
# File 'lib/polynomial_ruby/interpolation_algorithm.rb', line 4 def initialize(input) self.points = input.map { |a, _| a } self.values = input.map { |_, b| b } end |
Instance Attribute Details
#points ⇒ Object
Returns the value of attribute points.
2 3 4 |
# File 'lib/polynomial_ruby/interpolation_algorithm.rb', line 2 def points @points end |
#values ⇒ Object
Returns the value of attribute values.
2 3 4 |
# File 'lib/polynomial_ruby/interpolation_algorithm.rb', line 2 def values @values end |
Instance Method Details
#call(point) ⇒ Object
9 10 11 |
# File 'lib/polynomial_ruby/interpolation_algorithm.rb', line 9 def call(point) raise NotImplementedError, "Implement #call in #{self.class}" end |