118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
# File 'lib/pr2gpx/parser.rb', line 118
def parse input
Enumerator.new do |e|
xml = Nokogiri::XML(input)
xml.xpath('//item').each do |item|
%r{^
Position[ ]report[ ]for[ ]
(?<callsign>[^ ]*)
[ ]is[ ]
(?<latitude>[^ ]*)
[ ]/[ ]
(?<longitude>[^ ]*)
}x =~ item.xpath('title').first.content
= item.xpath('description').first.content
date = DateTime.parse(item.xpath('pubDate').first.content)
e.yield PositionReport.new callsign,
date,
Position.new(latitude, longitude),
end
end
end
|