summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-04-22 08:57:55 +0900
committerGitHub <[email protected]>2019-04-22 08:57:55 +0900
commit0e704d195f7af7d902e555b2c99b244d7e16b0d2 (patch)
tree60afc2367fbd8725da477924ac9a4591268e57a0
parenta025cd22681cbd067c833a063fad84fc3946ccd6 (diff)
parentcdb458ed4e07698ecb028bfe397fa273ed454e13 (diff)
downloadmruby-0e704d195f7af7d902e555b2c99b244d7e16b0d2.tar.gz
mruby-0e704d195f7af7d902e555b2c99b244d7e16b0d2.zip
Merge pull request #4396 from shuujii/commented-out-String-scan
Commented out `String#scan` because it is not implemented yet
-rw-r--r--mrbgems/mruby-enumerator/mrblib/enumerator.rb7
-rw-r--r--mrblib/string.rb21
-rw-r--r--test/t/string.rb4
3 files changed, 16 insertions, 16 deletions
diff --git a/mrbgems/mruby-enumerator/mrblib/enumerator.rb b/mrbgems/mruby-enumerator/mrblib/enumerator.rb
index 457687268..89472ef01 100644
--- a/mrbgems/mruby-enumerator/mrblib/enumerator.rb
+++ b/mrbgems/mruby-enumerator/mrblib/enumerator.rb
@@ -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
#
diff --git a/mrblib/string.rb b/mrblib/string.rb
index e9eb2be1d..c92a9e7be 100644
--- a/mrblib/string.rb
+++ b/mrblib/string.rb
@@ -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
diff --git a/test/t/string.rb b/test/t/string.rb
index 404cf03e1..e563db55a 100644
--- a/test/t/string.rb
+++ b/test/t/string.rb
@@ -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