summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-12-07 19:09:17 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-12-07 19:09:17 +0000
commitecc5a1df73814bf6bc5f7450d3f5cd7ead0c1386 (patch)
tree1b242394e3f7d2c81ec10b1959d9e9668a12f53d /lib
parent80f90813dffecfa96c3f296092ba326730607d2c (diff)
userdata: classes with singleton methods are not dumpable. dup the hash before storage
Diffstat (limited to 'lib')
-rw-r--r--lib/rbot/core/userdata.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/rbot/core/userdata.rb b/lib/rbot/core/userdata.rb
index 72cada78..f7c74a4a 100644
--- a/lib/rbot/core/userdata.rb
+++ b/lib/rbot/core/userdata.rb
@@ -90,10 +90,14 @@ class UserDataModule < CoreBotModule
return h[key]
end
- def set_data_hash(user, h)
+ def set_data_hash(user, hh)
iu = user.to_irc_user
bu = iu.botuser
+ # we .dup the hash to remove singleton methods
+ # and make it dump-able
+ h = hh.dup
+
@ircuser[iu.nick] = h
return h if bu.default?