class ASCIITextArt

Public Class Methods

new(motd) click to toggle source
Calls superclass method Component::new
# File lib/panda_motd/components/ascii_text_art.rb, line 7
def initialize(motd)
  super(motd, "ascii_text_art")
end

Public Instance Methods

process() click to toggle source
# File lib/panda_motd/components/ascii_text_art.rb, line 11
def process
  @text = `#{@config["command"]}`
  @art = Artii::Base.new font: @config["font"]
  @results = @art.asciify(@text)
  @results = @results.colorize(@config["color"].to_sym) if @config["color"]
rescue Errno::EISDIR # Artii doesn't handle invalid font names very well
  @errors << ComponentError.new(self, "Invalid font name")
end
to_s() click to toggle source
# File lib/panda_motd/components/ascii_text_art.rb, line 20
def to_s
  @results
end