diff options
author | Matthias H <apoc@sixserv.org> | 2014-07-18 15:37:26 +0200 |
---|---|---|
committer | Matthias H <apoc@sixserv.org> | 2014-07-18 15:37:26 +0200 |
commit | 2fb24ad9834f0544ac0eef0b589a71fa7add63cf (patch) | |
tree | d295cc72bfdccd80b50c7e034973ef8dc228c973 /lib/rbot | |
parent | ec56d8a5c3dd91da1f9ec1d9daf0fca8d1669810 (diff) |
add a first basic colorformat string function
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/core/utils/extends.rb | 11 |
1 files changed, 10 insertions, 1 deletions
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. |