Sha256: 5b6d0dc1de6d9f85b4e6bc94e62a2f53cdc4bf70e7cd6aa68317302200528444
Contents?: true
Size: 419 Bytes
Versions: 16
Compression:
Stored size: 419 Bytes
Contents
module InlineSvg::TransformPipeline::Transformations class Size < Transformation def transform(doc) with_svg(doc) do |svg| svg["width"] = width_of(self.value) svg["height"] = height_of(self.value) end end def width_of(value) value.split(/\*/).map(&:strip)[0] end def height_of(value) value.split(/\*/).map(&:strip)[1] || width_of(value) end end end
Version data entries
16 entries across 16 versions & 2 rubygems