Project

General

Profile

Actions

Backport #2428

closed

URI::Generic#eql? broken when passed nil

Added by pbmclain (Peter McLain) over 14 years ago. Updated about 13 years ago.


Description

=begin
URI::Generic#eql? does not check for nil:

 def eql?(oth)
   self.component_ary.eql?(oth.component_ary)
 end

Test Case:

require 'uri'
uri = URI.parse 'http://gemcutter.org'

uri.eql?(nil) # => blows up

Fix:

 def eql?(oth)
   return true if self.equal?(oth)
   self.class.equal?(oth.class) &&
     self.component_ary.eql?(oth.component_ary)
 end

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0