Class: Vimdeck::Ascii

Inherits:
Object
  • Object
show all
Defined in:
lib/vimdeck.rb

Overview

Helper methods for ascii art conversion

Class Method Summary collapse

Class Method Details

.header(text, type) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vimdeck.rb', line 11

def self.header(text, type)
  if font_name = Vimdeck::Slideshow.options[:header_font]
    begin
      font = Artii::Base.new :font => font_name
    rescue
      raise "Incorrect figlet font name"
    end
  else
    if type == "large"
      font = Artii::Base.new :font => 'slant'
    else
      font = Artii::Base.new :font => 'smslant'
    end
  end

  font.asciify(text)
end

.image(img) ⇒ Object



29
30
31
32
# File 'lib/vimdeck.rb', line 29

def self.image(img)
  a = AsciiArt.new(img)
  a.to_ascii_art width: 30
end