Commit 8f5017e7 authored by Yukihiro Matsumoto's avatar Yukihiro Matsumoto

raise NotImplementedError from regexp related string methods; close #319

parent ed9488f2
...@@ -33,12 +33,15 @@ class String ...@@ -33,12 +33,15 @@ class String
end end
### *** TODO *** ### ### *** TODO *** ###
unless Object.const_defined?(:Regexp)
raise NotImplementedError, "gsub not available (yet)"
end
end end
## ##
# Replace all matches of +pattern+ with +replacement+. # Replace all matches of +pattern+ with +replacement+.
# Call block (if given) for each match and replace # Call block (if given) for each match and replace
# +pattern+ with the value of the block. Modify # +pattern+ with the value of the block. Modify
# +self+ with the final value. # +self+ with the final value.
# #
# ISO 15.2.10.5.19 # ISO 15.2.10.5.19
...@@ -56,15 +59,18 @@ class String ...@@ -56,15 +59,18 @@ class String
# 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(reg, &block)
### *** TODO *** ### ### *** TODO *** ###
unless Object.const_defined?(:Regexp)
raise NotImplementedError, "scan not available (yet)"
end
end end
## ##
# Replace only the first match of +pattern+ with # Replace only the first match of +pattern+ with
# +replacement+. Call block (if given) for each # +replacement+. Call block (if given) for each
# match and replace +pattern+ with the value of the # match and replace +pattern+ with the value of the
# block. Return the final value. # block. Return the final value.
# #
...@@ -75,12 +81,15 @@ class String ...@@ -75,12 +81,15 @@ class String
end end
### *** TODO *** ### ### *** TODO *** ###
unless Object.const_defined?(:Regexp)
raise NotImplementedError, "sub not available (yet)"
end
end end
## ##
# Replace only the first match of +pattern+ with # Replace only the first match of +pattern+ with
# +replacement+. Call block (if given) for each # +replacement+. Call block (if given) for each
# match and replace +pattern+ with the value of the # match and replace +pattern+ with the value of the
# block. Modify +self+ with the final value. # block. Modify +self+ with the final value.
# #
# ISO 15.2.10.5.37 # ISO 15.2.10.5.37
......
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