Sha256: 7454dea66ae06e7501b61a1e9f7afb55f903cc04805bfd456119689e5aab8e32
Contents?: true
Size: 417 Bytes
Versions: 15
Compression:
Stored size: 417 Bytes
Contents
module InlineSvg::TransformPipeline::Transformations class DataAttributes < Transformation def transform(doc) doc = Nokogiri::XML::Document.parse(doc.to_html) svg = doc.at_css 'svg' with_valid_hash_from(self.value).each_pair do |name, data| svg["data-#{name}"] = data end doc end def with_valid_hash_from(hash) Hash.try_convert(hash) || {} end end end
Version data entries
15 entries across 15 versions & 1 rubygems