Parse and create data URLs in Ruby