Unverified Commit 0e704d19 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #4396 from shuujii/commented-out-String-scan

Commented out `String#scan` because it is not implemented yet
parents a025cd22 cdb458ed
...@@ -244,9 +244,10 @@ class Enumerator ...@@ -244,9 +244,10 @@ class Enumerator
# #
# === Examples # === Examples
# #
# "Hello, world!".scan(/\w+/) #=> ["Hello", "world"] # Array.new(3) #=> [nil, nil, nil]
# "Hello, world!".to_enum(:scan, /\w+/).to_a #=> ["Hello", "world"] # Array.new(3) { |i| i } #=> [0, 1, 2]
# "Hello, world!".to_enum(:scan).each(/\w+/).to_a #=> ["Hello", "world"] # Array.to_enum(:new, 3).to_a #=> [0, 1, 2]
# Array.to_enum(:new).each(3).to_a #=> [0, 1, 2]
# #
# obj = Object.new # obj = Object.new
# #
......
...@@ -105,18 +105,15 @@ class String ...@@ -105,18 +105,15 @@ class String
self.replace(str) self.replace(str)
end end
## # ##
# Calls the given block for each match of +pattern+ # # Calls the given block for each match of +pattern+
# If no block is given return an array with all # # If no block is given return an array with all
# matches of +pattern+. # # matches of +pattern+.
# # #
# ISO 15.2.10.5.32 # # ISO 15.2.10.5.32
def scan(reg, &block) # def scan(pattern, &block)
### *** TODO *** ### # # TODO: String#scan is not implemented yet
unless Object.const_defined?(:Regexp) # end
raise NotImplementedError, "scan not available (yet)"
end
end
## ##
# Replace only the first match of +pattern+ with # Replace only the first match of +pattern+ with
......
...@@ -509,7 +509,9 @@ assert('String#rindex(UTF-8)', '15.2.10.5.31') do ...@@ -509,7 +509,9 @@ assert('String#rindex(UTF-8)', '15.2.10.5.31') do
assert_equal nil, str.index("さ") assert_equal nil, str.index("さ")
end if UTF8STRING end if UTF8STRING
# 'String#scan', '15.2.10.5.32' will be tested in mrbgems. # assert('String#scan', '15.2.10.5.32') do
# # Not implemented yet
# end
assert('String#size', '15.2.10.5.33') do assert('String#size', '15.2.10.5.33') do
assert_equal 3, 'abc'.size assert_equal 3, 'abc'.size
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment