Class: MapSource::Track
- Inherits:
-
Object
- Object
- MapSource::Track
- Defined in:
- lib/mapsource/structure.rb
Overview
Public: A Track.
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #add_waypoint(wpt) ⇒ Object
- #each ⇒ Object
-
#initialize(name, color) ⇒ Track
constructor
A new instance of Track.
- #size ⇒ Object
- #waypoints ⇒ Object
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
#color ⇒ Object (readonly)
Returns the value of attribute color.
31 32 33 |
# File 'lib/mapsource/structure.rb', line 31 def color @color end |
#name ⇒ Object (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 |
#each ⇒ Object
51 52 53 |
# File 'lib/mapsource/structure.rb', line 51 def each @waypoints.each { |wpt| yield wpt if block_given? } end |
#size ⇒ Object
47 48 49 |
# File 'lib/mapsource/structure.rb', line 47 def size @waypoints.size end |
#waypoints ⇒ Object
39 40 41 |
# File 'lib/mapsource/structure.rb', line 39 def waypoints @waypoints.dup end |