]> git.openstreetmap.org Git - rails.git/blob - config/initializers/inline_svg.rb
Merge remote-tracking branch 'upstream/pull/6205'
[rails.git] / config / initializers / inline_svg.rb
1 module OpenStreetMap
2   class SvgToSymbolTransform < InlineSvg::CustomTransformation
3     def transform(doc)
4       with_svg(doc) do |svg|
5         svg.name = "symbol"
6       end
7     end
8   end
9
10   class SvgFillOverrideTransform < InlineSvg::CustomTransformation
11     def transform(doc)
12       with_svg(doc) do |svg|
13         svg.set_attribute("fill", value)
14       end
15     end
16   end
17 end
18
19 InlineSvg.configure do |config|
20   config.add_custom_transformation(:attribute => :to_symbol, :transform => OpenStreetMap::SvgToSymbolTransform)
21   config.add_custom_transformation(:attribute => :fill, :transform => OpenStreetMap::SvgFillOverrideTransform)
22 end