Module: StairCar::UMatrixCompare

Included in:
UMatrix
Defined in:
lib/stair_car/umatrix/compare.rb

Instance Method Summary collapse

Instance Method Details

#==(matrix2) ⇒ Object

Compares this matrix to another to see if they are the same (in values)



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/stair_car/umatrix/compare.rb', line 28

def ==(matrix2)
  if matrix2.is_a?(Fixnum) || matrix2.is_a?(Float)
    # See if its a 1x1
    if rows != 1 || cols != 1
      return false
    else
      # Check if the value matches
      return self.to_i == matrix2
    end
  else
    self.data.equalsContent(matrix2.data)
  end
end