Class: Rectangle

Inherits:
Figure show all
Defined in:
lib/sitac_objects.rb

Overview

Represents a rectangle, given a starting point, a horizontal length and a vertical length

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SITACObjects

#as_point

Constructor Details

#initialize(name, start, horizontal, vertical) ⇒ Rectangle

Returns a new instance of Rectangle.

Parameters:

  • name (String)

    the name of the rectangle

  • start (Point, Array)

    the starting point of the rectangle

  • horizontal (Float)

    the horizontal length of the rectangle

  • vertical (Float)

    the vertical length of the rectangle



83
84
85
86
87
88
89
# File 'lib/sitac_objects.rb', line 83

def initialize(name, start, horizontal, vertical)
  super
  @name = name
  @start = start
  @horizontal = horizontal
  @vertical = vertical
end

Instance Attribute Details

#horizontalObject (readonly)

Returns the value of attribute horizontal.



77
78
79
# File 'lib/sitac_objects.rb', line 77

def horizontal
  @horizontal
end

#nameObject (readonly)

Returns the value of attribute name.



77
78
79
# File 'lib/sitac_objects.rb', line 77

def name
  @name
end

#startObject (readonly)

Returns the value of attribute start.



77
78
79
# File 'lib/sitac_objects.rb', line 77

def start
  @start
end

#verticalObject (readonly)

Returns the value of attribute vertical.



77
78
79
# File 'lib/sitac_objects.rb', line 77

def vertical
  @vertical
end

Instance Method Details

#accept(visitor) ⇒ Object



91
92
93
# File 'lib/sitac_objects.rb', line 91

def accept(visitor)
  visitor.visit_rectangle self
end