Issue #8853 has been reported by okkez (okkez _).

----------------------------------------
Bug #8853: Should String#sub(pattern) returns an Enumerator?
https://bugs.ruby-lang.org/issues/8853

Author: okkez (okkez _)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


調?????????????????????????議?????????????????????????????????????????起票?????????

以???????????? String#sub(pattern) ??使?????? ArgumentError ?????????????????

$ ruby -e "p ''.sub(//)"
-e:1:in `sub': wrong number of arguments (1 for 2) (ArgumentError)
        from -e:1:in `<main>'

????? String#gsub(pattern) ?????? Enumerator ??????????????

$ ruby -e "p ''.gsub(//)"
#<Enumerator: "":gsub(//)>

RDoc ??????????????説????????????????????????????
String#gsub(pattern)???Enumerator????????????????????????????????????
http://www.ruby-doc.org/core-2.0.0/String.html#method-i-sub
http://www.ruby-doc.org/core-2.0.0/String.html#method-i-gsub

?貫??観????????????????????String#sub(pattern)???Enumerator??????????????????????????????????????????????????????????????????
???????String#sub ?????置???????????????????????????????????????????????????????

  * String#sub(pattern) ??? Enumerator ??????????????????
  * RDoc ??? String#gsub(pattern) ???????? String#sub(pattern) ??? ArgumentError ????????????????????????述??追???????????

???????????????????????????????????????????????????


-- 
http://bugs.ruby-lang.org/