INNER CODE UNIT · Ruby
self
busyloop/lolcat · lib/lolcat/lol.rb:79
def self.println_plain(str, defaults={}, opts={}, chomped)
opts.merge!(defaults)
set_mode(opts[:truecolor]) unless @paint_init
filtered = str.scan(ANSI_ESCAPE)
filtered.each_with_index do |c, i|
color = rainbow(opts[:freq], @os+i/opts[:spread])
if opts[:invert] then
print c[0], Paint.color(nil, color), c[1], "\e[49m"
else
print c[0], Paint.color(color), c[1], "\e[39m"
end
end
if chomped == nil
@old_os = @os
@os = @os + filtered.length/opts[:spread]
elsif @old_os
@os = @old_os