Module | Ascii85 |
In: |
lib/ascii85.rb
|
Ascii85 is an implementation of Adobe‘s binary-to-text encoding of the same name in pure Ruby.
See www.adobe.com/products/postscript/pdfs/PLRM.pdf page 131 and en.wikipedia.org/wiki/Ascii85 for more information about the format.
Author: | Johannes HolzfuĆ (Drangon@gmx.de) |
License: | Distributed under the MIT License (see README.txt) |
Searches through str and decodes the first Ascii85-String found.
decode expects an Ascii85-encoded String enclosed in <~ and ~>. It will ignore all characters outside these markers.
Ascii85::decode("<~;KZGo~>") => "Ruby" Ascii85::decode("Foo<~;KZGo~>Bar<~;KZGo~>Baz") => "Ruby" Ascii85::decode("No markers") => ""
decode will raise Ascii85::DecodingError when malformed input is encountered.
Encodes the given String as Ascii85.
If wrap_lines evaluates to false, the output will be returned as a single long line. Otherwise encode formats the output into lines of length wrap_lines (minimum is 2).
Ascii85::encode("Ruby") => <~;KZGo~> Ascii85::encode("Supercalifragilisticexpialidocious", 15) => <~;g!%jEarNoBkD BoB5)0rF*),+AU& 0.@;KXgDe!L"F`R ~> Ascii85::encode("Supercalifragilisticexpialidocious", false) => <~;g!%jEarNoBkDBoB5)0rF*),+AU&0.@;KXgDe!L"F`R~>