summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/chucknorris.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2014-02-20 21:06:10 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2021-05-29 16:21:46 +0200
commit8b811d21babf8f9e5a10a953b595d55ebd08820d (patch)
treed1237b886b04a336f59ef006c291cb4adf959de8 /data/rbot/plugins/chucknorris.rb
parent61bf4d98909457f96e5c3f71c36687e42cab53fe (diff)
chucknorris: read gzip stream before passing it to YAML.load
Prevents errors about external_encoding not being defined for the gzip stream in ruby 1.9+
Diffstat (limited to 'data/rbot/plugins/chucknorris.rb')
-rw-r--r--data/rbot/plugins/chucknorris.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/data/rbot/plugins/chucknorris.rb b/data/rbot/plugins/chucknorris.rb
index 42385ff3..177eccfb 100644
--- a/data/rbot/plugins/chucknorris.rb
+++ b/data/rbot/plugins/chucknorris.rb
@@ -19,7 +19,7 @@ class ChuckNorrisPlugin < Plugin
debug "+ [chucknorris] Loading #{path}..."
- @@facts = YAML.load(fyml).map{|fact,(score,votes)| votes >= MIN_VOTES ? [score,fact] : nil}.compact
+ @@facts = YAML.load(fyml.read).map{|fact,(score,votes)| votes >= MIN_VOTES ? [score,fact] : nil}.compact
debug "+ [chucknorris] #{@@facts.length} Chuck Norris facts loaded..."
debug " Random fact: #{@@facts[rand(@@facts.size)].inspect}"