class Rowr::Printer
Public Class Methods
new(line_length = 50)
click to toggle source
# File lib/rowr/printer.rb, line 7 def initialize(line_length = 50) @pastel = Pastel.new @line_length = line_length end
Public Instance Methods
line(text = '', char = '~')
click to toggle source
# File lib/rowr/printer.rb, line 12 def line(text = '', char = '~') message = text.to_s return message if too_long?(message) waves = char * ((@line_length - message.length) / 2).ceil output = "#{waves}#{message}#{waves}" output + (char * (50 - output.length)) end
line_break(duration)
click to toggle source
# File lib/rowr/printer.rb, line 25 def line_break(duration) puts "\n" sleep(duration) end
print_broken_link_warning(file, link)
click to toggle source
# File lib/rowr/printer.rb, line 49 def print_broken_link_warning(file, link) line_break 0 print_line '', '!', 'yellow' print_line ' Broken Link ', '!', 'yellow' puts @pastel.magenta.bold('File: ', @pastel.red(file)) puts @pastel.magenta.bold('Link: ', @pastel.green(link)) end
print_file_header(file)
click to toggle source
# File lib/rowr/printer.rb, line 57 def print_file_header(file) print_line ' FILE ', '*', 'cyan' print_line " #{file} ", '*', 'cyan' print_line '', '*', 'cyan' end
print_intro()
click to toggle source
# File lib/rowr/printer.rb, line 34 def print_intro print_line print_line ' ROWR! ' print_line line_break 1 end
print_line(message = nil, char = '~', color = 'green')
click to toggle source
# File lib/rowr/printer.rb, line 30 def print_line(message = nil, char = '~', color = 'green') puts @pastel.send(color.to_sym, line(message, char)) end
print_outro()
click to toggle source
# File lib/rowr/printer.rb, line 41 def print_outro print_line print_line " You're all done! " print_line print_line ' rowr... ' print_line end
too_long?(string)
click to toggle source
# File lib/rowr/printer.rb, line 21 def too_long?(string) string.length > @line_length end