summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-06-26 14:01:26 +0900
committerYukihiro Matsumoto <[email protected]>2012-06-26 14:01:26 +0900
commit8f5017e768b6cdc9b7ef824018561b9d300dfa5e (patch)
treee0ca16bd632b47e3ec30db73372803043acc2ec3
parented9488f2ca93a560a43295e6af046df6d3f4fa7d (diff)
downloadmruby-8f5017e768b6cdc9b7ef824018561b9d300dfa5e.tar.gz
mruby-8f5017e768b6cdc9b7ef824018561b9d300dfa5e.zip
raise NotImplementedError from regexp related string methods; close #319
-rw-r--r--mrblib/string.rb23
1 files changed, 16 insertions, 7 deletions
diff --git a/mrblib/string.rb b/mrblib/string.rb
index ad7e1fca1..d09b787da 100644
--- a/mrblib/string.rb
+++ b/mrblib/string.rb
@@ -33,12 +33,15 @@ class String
end
### *** TODO *** ###
+ unless Object.const_defined?(:Regexp)
+ raise NotImplementedError, "gsub not available (yet)"
+ end
end
##
# Replace all matches of +pattern+ with +replacement+.
# 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.
#
# ISO 15.2.10.5.19
@@ -56,15 +59,18 @@ class String
# 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
##
- # Replace only the first match of +pattern+ with
- # +replacement+. Call block (if given) for each
+ # Replace only the first match of +pattern+ with
+ # +replacement+. Call block (if given) for each
# match and replace +pattern+ with the value of the
# block. Return the final value.
#
@@ -75,12 +81,15 @@ class String
end
### *** TODO *** ###
+ unless Object.const_defined?(:Regexp)
+ raise NotImplementedError, "sub not available (yet)"
+ end
end
##
- # Replace only the first match of +pattern+ with
- # +replacement+. Call block (if given) for each
- # match and replace +pattern+ with the value of the
+ # Replace only the first match of +pattern+ with
+ # +replacement+. Call block (if given) for each
+ # match and replace +pattern+ with the value of the
# block. Modify +self+ with the final value.
#
# ISO 15.2.10.5.37