module Prawn::SVG::Loaders

Load a file from disk.

WINDOWS

Windows is supported, but must use URLs in the modern structure like:

file:///x:/path/to/the/file.png

or as a relative path:

directory/file.png

or as an absolute path from the current drive:

/path/to/the/file.png

Ruby's URI parser does not like backslashes, nor can it handle filenames as URLs starting with a drive letter as it thinks you're giving it a scheme.

URL ENCODING

This module assumes the URL that is passed in has been URL-encoded. If for some reason you're passing in a filename that hasn't been taken from an XML document's attribute, you will want to URL encode it before you pass it in.

FILES READ AS BINARY

At the moment, prawn-svg uses this class only to load graphical files, which are binary. This class therefore uses IO.binread to read file data. If it is ever used in the future to load text files, it will have to be taught about what kind of file it's expecting to read, and adjust the file read function accordingly.