Class: Geometry::Point

Inherits:
Struct
  • Object
show all
Defined in:
lib/point.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#xObject

Returns the value of attribute x

Returns:

  • (Object)

    the current value of x



2
3
4
# File 'lib/point.rb', line 2

def x
  @x
end

#yObject

Returns the value of attribute y

Returns:

  • (Object)

    the current value of y



2
3
4
# File 'lib/point.rb', line 2

def y
  @y
end

Class Method Details

.new_by_array(array) ⇒ Object



3
4
5
# File 'lib/point.rb', line 3

def self.new_by_array(array)      
  self.new(array[0], array[1])
end

Instance Method Details

#==(another_point) ⇒ Object



7
8
9
# File 'lib/point.rb', line 7

def ==(another_point)
  x === another_point.x && y === another_point.y
end