From 2fb24ad9834f0544ac0eef0b589a71fa7add63cf Mon Sep 17 00:00:00 2001 From: Matthias H Date: Fri, 18 Jul 2014 15:37:26 +0200 Subject: add a first basic colorformat string function --- lib/rbot/core/utils/extends.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/rbot/core/utils/extends.rb b/lib/rbot/core/utils/extends.rb index f3662395..11ebfc61 100644 --- a/lib/rbot/core/utils/extends.rb +++ b/lib/rbot/core/utils/extends.rb @@ -370,8 +370,17 @@ class ::String "#{pre}#{self}#{post}" end end -end + # Format a string using IRC colors + # + def colorformat + txt = self.dup + + txt.gsub!(/\*([^\*]+)\*/, Bold + '\\1' + NormalText) + + return txt + end +end # Extensions to the Regexp class, with some common and/or complex regular # expressions. -- cgit v1.2.3