0
0
Fork 0

Add support for ascii output with various symbol amount

The support for different chars in the output array was former
restricted to 10. But this is not necessary in the code. So I changed
that.
As example I've added the alphabet.
This commit is contained in:
Stormwind 2015-12-08 11:49:08 +01:00
parent 68fa6a937e
commit b30355b50f
1 changed files with 7 additions and 3 deletions

View File

@ -37,6 +37,10 @@ module Rubella
[" ", "·", ",", ";", "o", "O", "%", "8", "@", "#"]
@symbols["numbers"] =
[" ", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
@symbols["letters"] =
[" ", "a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k", "l", "m", "n", "o", "p", "q",
"r", "s", "t", "u", "v", "w", "x", "y", "z"]
self.used_symbols = "shades_ascii"
super data, field_size
@ -81,12 +85,12 @@ module Rubella
@data.each do |point|
i = 0
point.reverse.each do |part|
part = (part*10).to_i
part = (part*@symbols[@used_symbols].length).to_i
# Fix to prevent possible overflow.. should never happen, but we
# are careful
if part > 9
part = 9
if part > (@symbols[@used_symbols].length-1)
part = (@symbols[@used_symbols].length-1)
end
ascii_arr[i] << @symbols[@used_symbols][part]