diff options
-rw-r--r-- | lib/rbot/core/utils/extends.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/rbot/core/utils/extends.rb b/lib/rbot/core/utils/extends.rb index 42500ee0..083f2b85 100644 --- a/lib/rbot/core/utils/extends.rb +++ b/lib/rbot/core/utils/extends.rb @@ -283,6 +283,16 @@ class ::String def ircify_html_title self.get_html_title.ircify_html rescue nil end + + # This method is used to wrap a nonempty String by adding + # the prefix and postfix + def wrap_nonempty(pre, post, opts={}) + if self.empty? + String.new + else + "#{pre}#{self}#{post}" + end + end end |