module Termclock::ParseCharacters

Constants

CHARACTERS

Public Class Methods

display(c) click to toggle source
# File lib/termclock/parse_characters.rb, line 340
def display(c)
        j = []

        c.upcase.each_char { |x|
                @@characters.fetch(x, x).split(NEWLINE)
                .each_with_index { |z, i|
                        _j = j[i]
                        _j && _j << z || j[i] = z
                }
        }

        j.join(NEWLINE)
end
transform_characters!(arg) click to toggle source
# File lib/termclock/parse_characters.rb, line 319
def transform_characters!(arg)
        @@transformed ||= nil
        fail RuntimeError, 'Characters already transformed!' if @@transformed
        @@transformed ||= true

        @@characters.values.each { |x|
                stripped = x.strip[0]
                chars = arg.chars.rotate(-1)

                if stripped
                        replace_with = x.chars.map { |y|
                                chars = arg.chars.rotate(-1) if y == NEWLINE
                                next(y) if y != stripped
                                chars.rotate!(1)[0]
                        }.join

                        x.replace(replace_with)
                end
        }
end