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