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_file_header(file) click to toggle source
print_intro() click to toggle source
print_line(message = nil, char = '~', color = 'green') click to toggle source
print_outro() click to toggle source
too_long?(string) click to toggle source
# File lib/rowr/printer.rb, line 21
def too_long?(string)
  string.length > @line_length
end