From d9878de310537cec9c9db889b453b36464aafbe2 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 11 Sep 2007 05:53:51 +0000 Subject: Requirements: document 'htmlentities' dependency-with-fallback --- lib/rbot/core/utils/utils.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/rbot/core/utils/utils.rb b/lib/rbot/core/utils/utils.rb index a4f3ab8c..fe073c62 100644 --- a/lib/rbot/core/utils/utils.rb +++ b/lib/rbot/core/utils/utils.rb @@ -15,9 +15,9 @@ require 'tempfile' require 'set' +# Try to load htmlentities, fall back to an HTML escape table. begin require 'htmlentities' - $we_have_html_entities_decoder = true rescue LoadError gems = nil begin @@ -28,7 +28,6 @@ rescue LoadError if gems retry else - $we_have_html_entities_decoder = false module ::Irc module Utils UNESCAPE_TABLE = { @@ -396,7 +395,7 @@ module ::Irc def Utils.decode_html_entities(str) - if $we_have_html_entities_decoder + if defined? ::HTMLEntities return HTMLEntities.decode_entities(str) else str.gsub(/(&(.+?);)/) { -- cgit v1.2.3