Class: Andrewmcodes::Output
- Inherits:
-
Object
- Object
- Andrewmcodes::Output
- Defined in:
- lib/andrewmcodes/output.rb
Instance Method Summary collapse
- #ascii(a_string) ⇒ Object
- #centered_message(message) ⇒ Object
- #echo(message) ⇒ Object
- #log_info ⇒ Object
-
#log_to_console ⇒ Object
delegate :centered_message, to: :center.
- #terminal_width ⇒ Object
Instance Method Details
#ascii(a_string) ⇒ Object
29 30 31 32 33 |
# File 'lib/andrewmcodes/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/andrewmcodes/output.rb', line 52 def () content = Center.new(output: , columns: terminal_width) content.centered_content end |
#echo(message) ⇒ Object
48 49 50 |
# File 'lib/andrewmcodes/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/andrewmcodes/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
delegate :centered_message, to: :center
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/andrewmcodes/output.rb', line 10 def log_to_console if terminal_width >= 83 # content = Center.new(terminal_width-83, terminal_width) spces = Center.new(output: 83, columns: terminal_width) move_over = spces.spaces(100) ascii("#{move_over}andrewmcodes") p else echo("\nAndrew Mason \/ andrewmcodes\n") end log_info end |
#terminal_width ⇒ Object
25 26 27 |
# File 'lib/andrewmcodes/output.rb', line 25 def terminal_width @terminal_width ||= `tput cols`.strip.to_i end |