mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Commented out String#scan because it is not implemented yet
This commit is contained in:
@@ -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
|
||||
#
|
||||
|
||||
+9
-12
@@ -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
|
||||
|
||||
+3
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user