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
#
# === Examples
#
# "Hello, world!".scan(/\w+/) #=> ["Hello", "world"]
# "Hello, world!".to_enum(:scan, /\w+/).to_a #=> ["Hello", "world"]
# "Hello, world!".to_enum(:scan).each(/\w+/).to_a #=> ["Hello", "world"]
# Array.new(3) #=> [nil, nil, nil]
# Array.new(3) { |i| i } #=> [0, 1, 2]
# Array.to_enum(:new, 3).to_a #=> [0, 1, 2]
# Array.to_enum(:new).each(3).to_a #=> [0, 1, 2]
#
# obj = Object.new
#
......
......@@ -105,18 +105,15 @@ class String
self.replace(str)
end
##
# Calls the given block for each match of +pattern+
# If no block is given return an array with all
# matches of +pattern+.
#
# ISO 15.2.10.5.32
def scan(reg, &block)
### *** TODO *** ###
unless Object.const_defined?(:Regexp)
raise NotImplementedError, "scan not available (yet)"
end
end
# ##
# # Calls the given block for each match of +pattern+
# # If no block is given return an array with all
# # matches of +pattern+.
# #
# # ISO 15.2.10.5.32
# def scan(pattern, &block)
# # TODO: String#scan is not implemented yet
# end
##
# Replace only the first match of +pattern+ with
......
......@@ -509,7 +509,9 @@ assert('String#rindex(UTF-8)', '15.2.10.5.31') do
assert_equal nil, str.index("さ")
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_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