From b4342233a61b23035f61f0a796a7aa196744b99d Mon Sep 17 00:00:00 2001 From: franz Date: Sun, 28 Jun 2009 23:14:39 +0200 Subject: [PATCH] ruby 1.9: fix *methods.include? Since in 1.9 methods arrays have symbols instead of strings, fix it by changing into respond_to? and method_defined? --- lib/rbot/core/utils/httputil.rb | 2 +- lib/rbot/ircbot.rb | 2 +- lib/rbot/load-gettext.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rbot/core/utils/httputil.rb b/lib/rbot/core/utils/httputil.rb index 4ea83104..fa0addb9 100644 --- a/lib/rbot/core/utils/httputil.rb +++ b/lib/rbot/core/utils/httputil.rb @@ -25,7 +25,7 @@ require 'zlib' module ::Net class HTTPResponse attr_accessor :no_cache - if !instance_methods.include?('raw_body') + unless method_defined? :raw_body alias :raw_body :body end diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 9317fd4d..2f146c29 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -23,7 +23,7 @@ $log_thread = nil require 'pp' -unless Kernel.instance_methods.include?("pretty_inspect") +unless Kernel.respond_to? :pretty_inspect def pretty_inspect PP.pp(self, '') end diff --git a/lib/rbot/load-gettext.rb b/lib/rbot/load-gettext.rb index 4c2dc587..2c65f197 100644 --- a/lib/rbot/load-gettext.rb +++ b/lib/rbot/load-gettext.rb @@ -42,7 +42,7 @@ begin # patch for ruby-gettext 1.x to cope with anonymous modules used by rbot. # bound_targets and related methods are not used nor present in 2.x, and # this patch is not needed - if methods.include? 'bound_targets' + if method_defined? :bound_targets alias :orig_bound_targets :bound_targets def bound_targets(*a) # :nodoc: -- 2.39.5