diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-10-06 22:05:17 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-10-06 22:05:17 +0200 |
commit | 5d116465f221091fc381f6048ae1013d5cb60971 (patch) | |
tree | 3419b4f842ca5ddb8f69cbb85164e340884e73dd | |
parent | 719e3e00db7e85326bae04275b9d8c030ccf4892 (diff) |
figlet: strip first and last empty line(s)
-rw-r--r-- | data/rbot/plugins/figlet.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/data/rbot/plugins/figlet.rb b/data/rbot/plugins/figlet.rb index 64be496c..0eebc813 100644 --- a/data/rbot/plugins/figlet.rb +++ b/data/rbot/plugins/figlet.rb @@ -122,10 +122,16 @@ class FigletPlugin < Plugin exec_params = [send(:"#{key}_path")] + @params[key] + [message] # run the program - m.reply Utils.safe_exec(*exec_params), :max_lines => 0 + m.reply strip_first_last_empty_line(Utils.safe_exec(*exec_params)), :max_lines => 0 end alias :toilet :figlet + private + + def strip_first_last_empty_line(txt) + txt.gsub(/\A(?:^\s*\r?\n)+/m,'').rstrip + end + end plugin = FigletPlugin.new |