class Reportinator

Pretifies reports

Public Instance Methods

generate_banner(message, width=nil) click to toggle source

Generates a banner for a message based on the length of the message or a given width.

Attributes

  • message: The message to put.

  • width: The width of the message. If nil the size of the banner is

determined by the length of the message.

Examples

rp = Reportinator.new
rp.generate_banner("Hello world!") => "------------\nHello world!\n------------\n" 
rp.generate_banner("Hello world!", 3) => "---\nHello world!\n---\n"
# File lib/ceedling/reportinator.rb, line 21
def generate_banner(message, width=nil)
  dash_count = ((width.nil?) ? message.strip.length : width)
  return "#{'-' * dash_count}\n#{message}\n#{'-' * dash_count}\n"
end