Class: Njunusk::Output
- Inherits:
-
Object
- Object
- Njunusk::Output
- Defined in:
- lib/njunusk/output.rb
Instance Method Summary collapse
- #ascii(a_string) ⇒ Object
- #centered_message(message) ⇒ Object
- #echo(message) ⇒ Object
- #log_info ⇒ Object
- #log_to_console ⇒ Object
- #terminal_width ⇒ Object
Instance Method Details
#ascii(a_string) ⇒ Object
29 30 31 32 33 |
# File 'lib/njunusk/output.rb', line 29 def ascii(a_string) a = Artii::Base.new font: "slant" out = a.asciify(a_string) system("echo '#{out}' | lolcat") end |
#centered_message(message) ⇒ Object
52 53 54 55 |
# File 'lib/njunusk/output.rb', line 52 def () content = Center.new(output: , columns: terminal_width) content.centered_content end |
#echo(message) ⇒ Object
48 49 50 |
# File 'lib/njunusk/output.rb', line 48 def echo() system("echo '#{()}'") end |
#log_info ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/njunusk/output.rb', line 35 def log_info templates_root = File.(File.join(".", "."), File.dirname(__FILE__)) content = File.readlines "#{templates_root}/info.md" File.open("./../../temp.md", "w") do |_file| content.each do |line| system("echo '#{(line)}' | lolcat") end end FileUtils.rm("./../../temp.md") end |
#log_to_console ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/njunusk/output.rb', line 9 def log_to_console if terminal_width >= 83 spces = Center.new(output: 83, columns: terminal_width) move_over = spces.spaces(100) move_ovr = spces.spaces(110) ascii("#{move_over}njunusimon") ascii("#{move_ovr}rubyonrailsdev") p else echo("\nNjunu Simon \/ njunusimon\n") end log_info end |
#terminal_width ⇒ Object
25 26 27 |
# File 'lib/njunusk/output.rb', line 25 def terminal_width @terminal_width ||= `tput cols`.strip.to_i end |