summaryrefslogtreecommitdiffstats
path: root/tinyusb/test/vendor/ceedling/lib/ceedling/reportinator.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tinyusb/test/vendor/ceedling/lib/ceedling/reportinator.rb')
-rwxr-xr-xtinyusb/test/vendor/ceedling/lib/ceedling/reportinator.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/tinyusb/test/vendor/ceedling/lib/ceedling/reportinator.rb b/tinyusb/test/vendor/ceedling/lib/ceedling/reportinator.rb
new file mode 100755
index 00000000..0f583d06
--- /dev/null
+++ b/tinyusb/test/vendor/ceedling/lib/ceedling/reportinator.rb
@@ -0,0 +1,26 @@
+##
+# Pretifies reports
+class Reportinator
+
+ ##
+ # 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"
+ #
+ #
+ def generate_banner(message, width=nil)
+ dash_count = ((width.nil?) ? message.strip.length : width)
+ return "#{'-' * dash_count}\n#{message}\n#{'-' * dash_count}\n"
+ end
+
+end