Module: Bumpspark::Formats::DataURI

Included in:
Graph
Defined in:
lib/bumpspark/formats/data_uri.rb

Instance Method Summary collapse

Instance Method Details

#to_data_uriString

Generate a Data URI



15
16
17
18
# File 'lib/bumpspark/formats/data_uri.rb', line 15

def to_data_uri
  data = Base64.encode64(to_png).delete("\n")
  "data:image/png;base64,#{CGI.escape(data)}"
end