Class: Line

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

Overview

Represents a line, given a list of points

Direct Known Subclasses

Polygon

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SITACObjects

#as_point

Constructor Details

#initialize(name, points) ⇒ Line

Returns a new instance of Line.

Parameters:

  • name (String)

    the name of the line

  • points (Array<Point>, Array<Array>)

    the list of points of the line



55
56
57
58
59
60
61
62
# File 'lib/sitac_objects.rb', line 55

def initialize(name, points)
  super
  @name = name
  @points = []
  points.each do |point|
    @points << as_point(point)
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



51
52
53
# File 'lib/sitac_objects.rb', line 51

def name
  @name
end

#pointsObject (readonly)

Returns the value of attribute points.



51
52
53
# File 'lib/sitac_objects.rb', line 51

def points
  @points
end

Instance Method Details

#accept(visitor) ⇒ Object



64
65
66
# File 'lib/sitac_objects.rb', line 64

def accept(visitor)
  visitor.visit_line self
end