module FPrinter
Constants
- CONSOLE_MATCHES
Public Class Methods
appear_from_left(str, sec = 0.05)
click to toggle source
# File lib/fprinter/printer_change.rb, line 22 def self.appear_from_left(str, sec = 0.05) s = str.length str.split("").each_with_index do |l, i| print "\e[K", str[(s-1-i)..(s-1)], "\e[D" * (i + 1) sleep(sec) print "\e[D" * (s - i) end print "\e[D" * 2, "\n" end
appear_from_right(str, sec = 0.05)
click to toggle source
# File lib/fprinter/printer_change.rb, line 32 def self.appear_from_right(str, sec = 0.05) s = str.length str.split("").each_with_index do |l, i| print "\e[K", " " * (s - i - 1), str[0..(i)] sleep(sec) print "\e[D" * (s + i) end print "\e[D" * 2, "\n" end
big(str)
click to toggle source
# File lib/fprinter/display_change.rb, line 39 def self.big(str) transform = str.split("") line0, line1, line2, line3, line4, line5 = [], [], [], [], [], [] transform.each do |letter| letter.downcase! raise "Unknown character #{letter}" if !BIG_LETTERS.has_key?(letter) line0 << LINE0[BIG_LETTERS[letter]..(BIG_LETTERS[letter.next] - 1)] line1 << LINE1[BIG_LETTERS[letter]..(BIG_LETTERS[letter.next] - 1)] line2 << LINE2[BIG_LETTERS[letter]..(BIG_LETTERS[letter.next] - 1)] line3 << LINE3[BIG_LETTERS[letter]..(BIG_LETTERS[letter.next] - 1)] line4 << LINE4[BIG_LETTERS[letter]..(BIG_LETTERS[letter.next] - 1)] line5 << LINE5[BIG_LETTERS[letter]..(BIG_LETTERS[letter.next] - 1)] end puts line0.join("") puts line1.join("") puts line2.join("") puts line3.join("") puts line4.join("") puts line5.join("") end
clean!()
click to toggle source
# File lib/fprinter/screen.rb, line 3 def self.clean! print "\e[2J" end
flush!()
click to toggle source
# File lib/fprinter/screen.rb, line 15 def self.flush! $stdout.flush end
move_to_home!()
click to toggle source
# File lib/fprinter/screen.rb, line 7 def self.move_to_home! print "\e[H" end
reset!()
click to toggle source
# File lib/fprinter/screen.rb, line 11 def self.reset! print "\e[0m\n" end
reverse(str, sec = 0.05)
click to toggle source
# File lib/fprinter/printer_change.rb, line 42 def self.reverse(str, sec = 0.05) s = str.length str.split("").each_with_index do |l, i| print "\e[K", " " * (s - i - 1), str[(s-1-i)..(s-1)], "\e[D" * (i + 1) sleep(sec) print "\e[D" * (s - i) end print "\e[D" * 2, "\n" end
slow(str, sec = 0.05)
click to toggle source
# File lib/fprinter/printer_change.rb, line 4 def self.slow(str, sec = 0.05) str.split("").each do |l| print l sleep(sec) end puts "" end
slow_unprint(str, sec = 0.05)
click to toggle source
# File lib/fprinter/printer_change.rb, line 12 def self.slow_unprint(str, sec = 0.05) s = str.length str.split("").each_with_index do |l, i| print "\e[K", str[0..(s-i)] sleep(sec) print "\e[D" * (s - i + 2) end print "\e[D" * 2, "\e[K", "\n" end