Module: DECRadix50

Defined in:
lib/dec_radix_50.rb,
lib/dec_radix_50/decoder.rb,
lib/dec_radix_50/encoder.rb,
lib/dec_radix_50/version.rb

Overview

Encodes strings to the DEC Radix-50 encoding.

Defined Under Namespace

Classes: ArgumentError, Decoder, Encoder, Error

Constant Summary collapse

MK90_CHARSET =

Elektronika MK90 filenames charset:

" ABCDEFGHIJKLMNOPQRSTUVWXYZ$./0123456789"
RT11_CHARSET =

RT-11 filenames charset:

" ABCDEFGHIJKLMNOPQRSTUVWXYZ$%*0123456789"
VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.decode(charset, int_array) ⇒ String

Decode array of integers to a string.

Parameters:

  • charset (String)
  • int_array (Array<Integer>)

    Integer values to decode.

Returns:

  • (String)


50
51
52
# File 'lib/dec_radix_50.rb', line 50

def self.decode(charset, int_array)
  Decoder.new(charset, int_array).decode
end

.encode(charset, string, replace_char = " ") ⇒ Array<Integer>

Encode a string to the DEC Radix-50 encoding.

Parameters:

  • charset (String)
  • string (String)

    String to encode.

  • [String] (Hash)

    a customizable set of options

Returns:

  • (Array<Integer>)

    Radix-50 (decimal numeral system).



36
37
38
# File 'lib/dec_radix_50.rb', line 36

def self.encode(charset, string, replace_char = " ")
  Encoder.new(charset, string, replace_char).encode
end