class PrawnHtml::Attributes

def data

Returns:
  • (Hash) - hash of data attributes with 'data-' prefix removed and stripped values
def data
  to_h.each_with_object({}) do |(key, value), res|
    data_key = key.match /\Adata-(.+)/
    res[data_key[1]] = value.strip if data_key
  end
end