Class: Point

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

Overview

Represents a point

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SITACObjects

#as_point

Constructor Details

#initialize(name, latitude, longitude) ⇒ Point

Returns a new instance of Point.

Parameters:

  • name (String)

    the name of the point

  • latitude (Float)

    the latitude of the point

  • longitude (Float)

    the longitude of the point



33
34
35
36
37
38
# File 'lib/sitac_objects.rb', line 33

def initialize(name, latitude, longitude)
  super
  @name = name
  @latitude = latitude
  @longitude = longitude
end

Instance Attribute Details

#latitudeObject (readonly)

Returns the value of attribute latitude.



28
29
30
# File 'lib/sitac_objects.rb', line 28

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



28
29
30
# File 'lib/sitac_objects.rb', line 28

def longitude
  @longitude
end

#nameObject (readonly)

Returns the value of attribute name.



28
29
30
# File 'lib/sitac_objects.rb', line 28

def name
  @name
end

Instance Method Details

#accept(visitor) ⇒ Object



40
41
42
# File 'lib/sitac_objects.rb', line 40

def accept(visitor)
  visitor.visit_point self
end

#to_pObject



44
45
46
# File 'lib/sitac_objects.rb', line 44

def to_p
  self
end