Class: SimplePolygons::Circle

Inherits:
Object
  • Object
show all
Defined in:
lib/simple-polygons.rb

Overview

Represents a circle object. Although it extends polygon, @points is never used and cannot be modified.

Instance Method Summary collapse

Constructor Details

#initialize(center_loc, rad) ⇒ Circle

center_loc should be a location and rad should be a float or integer.



81
82
83
84
# File 'lib/simple-polygons.rb', line 81

def initialize(center_loc, rad)
  @center = center_loc
  @radius = rad
end

Instance Method Details

#diameterObject



95
96
97
# File 'lib/simple-polygons.rb', line 95

def diameter()
  return @radius * 2
end

#diameter=(value) ⇒ Object



98
99
100
# File 'lib/simple-polygons.rb', line 98

def diameter=(value)
      @radius = (value / 2)
end

#pointsObject

Always returns 0.



87
88
89
# File 'lib/simple-polygons.rb', line 87

def points()
  return 0
end

#points=(value) ⇒ Object

This does not do anything.



91
92
93
# File 'lib/simple-polygons.rb', line 91

def points=(value)

end