#!/usr/bin/env ruby require 'net/http' require 'rexml/document' ProgramName = File.basename($0) ProgramVers = "0.6" ProgramAuth = "Patrick Mueller (pmuellr@yahoo.com)" #-------------------------------------------------------------------- # defines weather info #-------------------------------------------------------------------- class Weather attr_reader :desc #------------------------------------------------------------------ # initializer #------------------------------------------------------------------ def initialize(desc) @desc = desc end end #-------------------------------------------------------------------- # defines a location on the map #-------------------------------------------------------------------- class Location attr_reader :name, :url, :zip, :lat, :long, :weather attr_writer :weather #------------------------------------------------------------------ # initializer #------------------------------------------------------------------ def initialize(name, url, zip, lat, long) @name = name @url = url @zip = zip @lat = lat @long = long end #------------------------------------------------------------------ # return string representation #------------------------------------------------------------------ def to_s() "#{@name}\n\t#{@url}\n\t#{@zip}\n\t#{@lat}, #{@long}\n" end #------------------------------------------------------------------ # return whether entry is complete #------------------------------------------------------------------ def is_complete?() return false if @name.nil? || @name.empty? return false if @url.nil? || @url.empty? return false if @zip.nil? || @zip.empty? return false if @lat.nil? || @lat.empty? return false if @long.nil? || @long.empty? true end end #-------------------------------------------------------------------- # #-------------------------------------------------------------------- def help() print < North Carolina Parks North Carolina Parks 1 Parks of North Carolina. HTML_HEADER htmlTrailer = < HTML_TRAILER File.open(oFileName,"w") { | file | file.puts(htmlHeader) locations.each { |location| geotagURL = "http://www.flickr.com/map/?&fLat=#{location.lat}&fLon=#{location.long}&zl=5" htmlEntry = < #{location.name} #hiking-icon Visit the park's web site. Show geotagged Flickr pictures.

#{location.weather.desc}

#{dateTime}

]]>
#{location.long},#{location.lat},0 HTML_ENTRY file.puts(htmlEntry) } file.puts(htmlTrailer) } #-------------------------------------------------------------------- # write summary #-------------------------------------------------------------------- puts "Wrote #{locations.size} locations to #{oFileName}"