module OpenStreetMap
  class SvgToSymbolTransform < InlineSvg::CustomTransformation
    def transform(doc)
      with_svg(doc) do |svg|
        svg.name = "symbol"
      end
    end
  end

  class SvgFillOverrideTransform < InlineSvg::CustomTransformation
    def transform(doc)
      with_svg(doc) do |svg|
        svg.set_attribute("fill", value)
      end
    end
  end
end

InlineSvg.configure do |config|
  config.add_custom_transformation(:attribute => :to_symbol, :transform => OpenStreetMap::SvgToSymbolTransform)
  config.add_custom_transformation(:attribute => :fill, :transform => OpenStreetMap::SvgFillOverrideTransform)
end
