class InlineSvg::TransformPipeline::Transformations::DataAttributes
def dasherize(string)
def dasherize(string) string.to_s.gsub(/_/, "-") end
def transform(doc)
def transform(doc) with_svg(doc) do |svg| with_valid_hash_from(self.value).each_pair do |name, data| svg["data-#{dasherize(name)}"] = data end end end
def with_valid_hash_from(hash)
def with_valid_hash_from(hash) Hash.try_convert(hash) || {} end