class Polynomials::Point

Attributes

to_f[RW]
x[RW]
y[RW]

Public Class Methods

new(x,y) click to toggle source
# File lib/polynomials/point.rb, line 15
def initialize(x,y)
  @x,@y = x,y
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/polynomials/point.rb, line 23
def <=>(other)
  if self.x < other.x
    -1
  elsif self.x > other.x
    1
  elsif self.x == other.x && self.y == other.y
    0
  end
end
eql?(other) click to toggle source
# File lib/polynomials/point.rb, line 33
def eql?(other)
  self.x == other.x &&
    self.y == other.y &&
    other.class == self.class
end
to_s() click to toggle source
# File lib/polynomials/point.rb, line 19
def to_s
  "(#{self.x.inspect},#{self.y.inspect})"
end