Class: MapSource::Track

Inherits:
Object
  • Object
show all
Defined in:
lib/mapsource/structure.rb

Overview

Public: A Track.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, color) ⇒ Track

Returns a new instance of Track.



33
34
35
36
37
# File 'lib/mapsource/structure.rb', line 33

def initialize(name, color)
  @name = name
  @color = color
  @waypoints = []
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



31
32
33
# File 'lib/mapsource/structure.rb', line 31

def color
  @color
end

#nameObject (readonly)

Returns the value of attribute name.



31
32
33
# File 'lib/mapsource/structure.rb', line 31

def name
  @name
end

Instance Method Details

#add_waypoint(wpt) ⇒ Object



43
44
45
# File 'lib/mapsource/structure.rb', line 43

def add_waypoint(wpt)
  @waypoints << wpt
end

#eachObject



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

def each
  @waypoints.each { |wpt| yield wpt if block_given? }
end

#sizeObject



47
48
49
# File 'lib/mapsource/structure.rb', line 47

def size
  @waypoints.size
end

#waypointsObject



39
40
41
# File 'lib/mapsource/structure.rb', line 39

def waypoints
  @waypoints.dup
end