Class: Square
Overview
square.rb
Instance Attribute Summary collapse
-
#size ⇒ Object
Returns the value of attribute size.
Attributes inherited from Rectangle
Attributes inherited from Quad
#c1, #c2, #c3, #c4, #color, #x1, #x2, #x3, #x4, #y1, #y2, #y3, #y4
Instance Method Summary collapse
-
#initialize(x = 0, y = 0, s = 100, c = "white", visible = true) ⇒ Square
constructor
A new instance of Square.
Methods inherited from Rectangle
Methods inherited from Quad
Constructor Details
#initialize(x = 0, y = 0, s = 100, c = "white", visible = true) ⇒ Square
Returns a new instance of Square.
7 8 9 10 11 12 13 |
# File 'lib/r2d/square.rb', line 7 def initialize(x=0, y=0, s=100, c="white", visible=true) @x, @y, @color = x, y, c @width = @height = @size = s update_coords(x, y, s, s) update_color(c) if visible then add end end |
Instance Attribute Details
#size ⇒ Object
Returns the value of attribute size.
5 6 7 |
# File 'lib/r2d/square.rb', line 5 def size @size end |