# encoding: utf-8 require 'csv' module BikePOA class MapParser EXIBIRESTACAMAPA = /^exibirEstacaMapa\((.*?)\);/m CRIAPONTO = /criaPonto\(point,(.*)\) \);/ def parse(content) content.scan(EXIBIRESTACAMAPA).map do |station_match| line_data = CSV.parse_line(station_match.first.gsub(/\r?\n/,''), quote_char: "\"") fields = %w[_ _ _ name id online status available size address] Hash[fields.zip(line_data)].delete_if { |key,value| key == '_' } end end end end