Class: Visitor
Overview
Note:
This class is generic and not used as is
Generic Visitor class for Melissa Converter NG
Direct Known Subclasses
Constant Summary
Constants included from LogUtils
Instance Method Summary collapse
-
#initialize ⇒ Visitor
constructor
A new instance of Visitor.
-
#visit_bullseye(bullseye) ⇒ Object
visit a bullseye.
-
#visit_corridor(corridor) ⇒ Object
visit a corridor.
-
#visit_ellipse(ellipse) ⇒ Object
visit an ellipse.
-
#visit_line(line) ⇒ Object
visit a line.
-
#visit_point(point) ⇒ Object
visit a point.
-
#visit_polygon(polygon) ⇒ Object
visit a polygon.
-
#visit_rectangle(rectangle) ⇒ Object
visit a rectangle.
Constructor Details
#initialize ⇒ Visitor
Returns a new instance of Visitor.
69 70 71 |
# File 'lib/kml_maker.rb', line 69 def initialize @content = '' end |
Instance Method Details
#visit_bullseye(bullseye) ⇒ Object
visit a bullseye
110 111 112 113 114 115 |
# File 'lib/kml_maker.rb', line 110 def visit_bullseye(bullseye) @content += "Bullseye: #{bullseye.name}\n" visit_point bullseye.center @content += "Rings: #{bullseye.rings}\n" @content += "Distance: #{bullseye.distance}\n\n" end |
#visit_corridor(corridor) ⇒ Object
visit a corridor
128 129 130 131 132 133 |
# File 'lib/kml_maker.rb', line 128 def visit_corridor(corridor) @content += "Corridor: #{corridor.name}\n" visit_point corridor.start visit_point corridor.end @content += "Width: #{corridor.width}\n\n" end |
#visit_ellipse(ellipse) ⇒ Object
visit an ellipse
119 120 121 122 123 124 |
# File 'lib/kml_maker.rb', line 119 def visit_ellipse(ellipse) @content += "Ellipse: #{ellipse.name}\n" visit_point ellipse.center @content += "Horizontal: #{ellipse.horizontal}\n" @content += "Vertical: #{ellipse.vertical}\n\n" end |
#visit_line(line) ⇒ Object
visit a line
81 82 83 84 85 86 87 |
# File 'lib/kml_maker.rb', line 81 def visit_line(line) @content += "Line: #{line.name}\n" line.points.each do |point| visit_point point end @content += "\n" end |
#visit_point(point) ⇒ Object
visit a point
75 76 77 |
# File 'lib/kml_maker.rb', line 75 def visit_point(point) @content += "Point: #{point.name} (#{point.latitude}, #{point.longitude})\n" end |
#visit_polygon(polygon) ⇒ Object
visit a polygon
91 92 93 94 95 96 97 |
# File 'lib/kml_maker.rb', line 91 def visit_polygon(polygon) @content += "Polygon: #{polygon.name}\n" polygon.points.each do |point| visit_point point end @content += "\n" end |
#visit_rectangle(rectangle) ⇒ Object
visit a rectangle
101 102 103 104 105 106 |
# File 'lib/kml_maker.rb', line 101 def visit_rectangle(rectangle) @content += "Rectangle: #{rectangle.name}\n" visit_point rectangle.start @content += "Horizontal: #{rectangle.horizontal}\n" @content += "Vertical: #{rectangle.vertical}\n\n" end |