From 8b811d21babf8f9e5a10a953b595d55ebd08820d Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 20 Feb 2014 21:06:10 +0100 Subject: 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+ --- data/rbot/plugins/chucknorris.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'data/rbot/plugins') 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}" -- cgit v1.2.3