Class: Interpolation::Base
- Inherits:
-
Object
- Object
- Interpolation::Base
- Defined in:
- lib/interpolation/base.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(x, y, opts) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(x, y, opts) ⇒ Base
Returns a new instance of Base.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/interpolation/base.rb', line 16 def initialize x, y, opts @x, @y = x, y @opts = { precision: 3, sorted: false, type: :linear }.merge(opts) @size = @x.size # considers size of @x only @x = @x.sort unless @opts[:sorted] @x.map! { |n| n = Float(n)} end |