Module: Datafy
- Defined in:
- lib/juicer/datafy/datafy.rb
Class Method Summary collapse
Class Method Details
.make_data_uri(content, content_type) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/juicer/datafy/datafy.rb', line 9 def Datafy::make_data_uri(content, content_type) outuri = 'data:' + content_type unless content_type =~ /^text/i # base64 encode if not text outuri += ';base64' content = Base64.encode64(content).gsub("\n", '') else content = CGI::escape(content) end outuri += ",#{content}" end |