Project

General

Profile

Bug #722 ยป optparse.patch

patches 1 file: lib/optparse.rb - nluv4hs (Keith Cascio), 11/08/2008 09:01 AM

View differences:

/usr/local/lib/ruby/1.9.1/optparse.rb 2008-11-07 15:27:19.000000000 -0800
1073 1073
        end
1074 1074
      end
1075 1075

  
1076
################################################################
1077
#
1078
# author: keith cascio, since: 20081107, keith@ucla.edu
1079
#
1080
# fix necessary because Ruby 1.9 Symbols respond to :match
1081
#
1082
# 1107140223> /usr/bin/irb
1083
# irb(main):001:0> RUBY_VERSION
1084
# => "1.8.5"
1085
# irb(main):002:0> :keith.respond_to?( :match )
1086
# => false
1087
# irb(main):003:0> exit
1088
# 1107140240> irb
1089
# irb(main):001:0> RUBY_VERSION
1090
# => "1.9.1"
1091
# irb(main):002:0> :keith.respond_to?( :match )
1092
# => true
1093
# irb(main):003:0> exit
1094
#
1095
################################################################
1076 1096
      # directly specified pattern(any object possible to match)
1077
      if !(String === o) and o.respond_to?(:match)
1097
      if (!(String === o || Symbol === o)) and o.respond_to?(:match)
1078 1098
        pattern = notwice(o, pattern, 'pattern')
1079 1099
        conv = pattern.method(:convert).to_proc if pattern.respond_to?(:convert)
1080 1100
        next