summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKOBAYASHI Shuji <[email protected]>2019-04-21 20:34:39 +0900
committerKOBAYASHI Shuji <[email protected]>2019-04-21 20:34:39 +0900
commitcdb458ed4e07698ecb028bfe397fa273ed454e13 (patch)
treea9733908f2646f908bb1e190bca095c23551b435
parent88c3595db3349515634ad21a1595a5ab6b88375c (diff)
downloadmruby-cdb458ed4e07698ecb028bfe397fa273ed454e13.tar.gz
mruby-cdb458ed4e07698ecb028bfe397fa273ed454e13.zip
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