]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
ruby 1.9: fix *methods.include?
authorfranz <Franz.Netykafka@runbox.com>
Sun, 28 Jun 2009 21:14:39 +0000 (23:14 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Wed, 26 Aug 2009 21:31:38 +0000 (23:31 +0200)
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
lib/rbot/ircbot.rb
lib/rbot/load-gettext.rb

index 4ea83104ccc51a4d86a1cff0f89afd2995893725..fa0addb98a2ec6b067df091cdafb3d10ec5eb6fc 100644 (file)
@@ -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
 
index 9317fd4d16a131241c01ef527379675fef1aca0a..2f146c2936b8cf1e1ce348d465e1012c790d5dbb 100644 (file)
@@ -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
index 4c2dc5874bbb6240de6eac9118dbd916f752b053..2c65f19780e7cec70bb958bb58b7877c06fa5630 100644 (file)
@@ -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: