summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorSpencer Rinehart <anubis@overthemonkey.com>2009-03-06 10:08:06 -0500
committerSpencer Rinehart <anubis@overthemonkey.com>2009-03-06 10:22:21 -0500
commit0a44338d09e921440fac821b1db8d03e71a10ff0 (patch)
tree053a7893a887719aa9f2275a581535ec35c9e7cc /lib/rbot
parentc3aec9254dd9e48c0fcc7bfd5432d6555b881071 (diff)
irc: monkeypatch Singleton to make _load and _dump public.
This is to fix a possible bug in newer versions of ruby where _load was declared private in singletons. This would lead to errors where Marshal could not restore the Singleton. This "bug" was introduced to ruby in revisions 16659 and 17396.
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/irc.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb
index 4c462bb3..9a9998e7 100644
--- a/lib/rbot/irc.rb
+++ b/lib/rbot/irc.rb
@@ -21,6 +21,19 @@
require 'singleton'
+# The following monkeypatch is to fix a bug in Singleton where marshaling would
+# fail when trying to restore a marshaled Singleton due to _load being declared
+# private.
+module ::Singleton
+ public :_dump
+end
+
+class << Singleton
+ module SingletonClassMethods
+ public :_load
+ end
+end
+
class Object
# We extend the Object class with a method that