Module Ascii85
In: lib/Ascii85/version.rb
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ß (DataWraith@web.de)
License:Distributed under the MIT License (see README.rdoc)

Methods

decode   encode  

Classes and Modules

Class Ascii85::DecodingError

Constants

VERSION = "1.0.1"

Public Class methods

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. The returned strings are always encoded as ASCII-8BIT.

    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 bytes of 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~>

[Validate]