Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 585 Bytes

how-to-colorize-ruby-output.md

File metadata and controls

21 lines (15 loc) · 585 Bytes

How To Colorize Ruby Output

📓

Use gem colorize. Check out my code snippet in post_template.rb

require 'colorize'

print "input topic name: "
input_topic_name = gets.chomp

file_title = input_topic_name.split.map { |word| word.capitalize }.join(" ")
file_name = input_topic_name.gsub(/\s+/m,"-") + ".md"
# colorize my output 
puts "new file: " + file_name.green + " with title: " + file_title.blue

Reference