diff options
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/core/utils/extends.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/rbot/core/utils/extends.rb b/lib/rbot/core/utils/extends.rb index 1aa6d457..80bad383 100644 --- a/lib/rbot/core/utils/extends.rb +++ b/lib/rbot/core/utils/extends.rb @@ -85,8 +85,7 @@ end # Extensions to the String class # -# TODO make ircify_html() accept an Hash of options, and make riphtml() just -# call ircify_html() with stronger purify options. +# TODO make riphtml() just call ircify_html() with stronger purify options. # class ::String @@ -156,9 +155,14 @@ class ::String # And finally whitespace is squeezed txt.gsub!(/\s+/, ' ') + txt.strip! + + if opts[:limit] && txt.size > opts[:limit] + txt = txt.slice(0, opts[:limit]) + "#{Reverse}...#{Reverse}" + end # Decode entities and strip whitespace - return txt.strip + return txt end # As above, but modify the receiver |