From 4df520caa1c36ed3a0a920988b7794422b32abb1 Mon Sep 17 00:00:00 2001 From: Chris Watson Date: Sun, 30 Jan 2022 19:30:44 -0700 Subject: [PATCH] chg: removed all instances of Vector.method Converted `Vector.method` calls to `self.class.method` to make extending Vector easier. --- src/apatite/vector.cr | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/apatite/vector.cr b/src/apatite/vector.cr index 413ad3f..e246007 100644 --- a/src/apatite/vector.cr +++ b/src/apatite/vector.cr @@ -275,28 +275,28 @@ module Apatite # `imag` as the imaginary number. def coerce(klass : Complex.class, imag : Number) els = @elements.map { |e| Complex.new(e, imag) } - Vector.elements(els) + self.class.elements(els) end # Attempt to coerce the elements in a vector to BigInt with # an optional `base` value. def coerce(klass : BigInt.class, base = 10) els = @elements.map { |e| BigInt.new(e, base) } - Vector.elements(els) + self.class.elements(els) end # Attempt to coerce the elements in a vector to BigRational # with the given `denominator`. def coerce(klass : BigRational.class, denominator : Int) els = @elements.map { |e| BigRational.new(e, denominator) } - Vector.elements(els) + self.class.elements(els) end # The coerce method allows you to attempt to coerce the elements # in the matrix to another type. def coerce(klass : U.class) : Vector(U) forall U els = @elements.map { |e| klass.new(e).as(U) } - Vector.elements(els) + self.class.elements(els) end # Returns the elements of the vector in an array.