diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-09 11:57:06 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-09 11:57:06 +0000 |
commit | 2d101f0a87ed256fda0b85a93ad89997ff0f2f13 (patch) | |
tree | 5c3c67d662410da499a8898ecb3c2695eee78589 | |
parent | 7a7c26be7328099b4b2ba57ba9547e20080e071f (diff) | |
download | ruby-2d101f0a87ed256fda0b85a93ad89997ff0f2f13.tar.gz |
Regexp#fixed_encoding? documented.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | re.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -758,6 +758,31 @@ rb_match_busy(VALUE match) FL_SET(match, MATCH_BUSY); } +/* + * call-seq: + * rxp.fixed_encoding? => true or false + * + * Returns true if rxp is only applicable to + * a string encoded as rxp.encoding. + * + * r = /a/ + * r.fixed_encoding? #=> false + * r =~ "\u{6666} a" #=> 2 + * r =~ "\xa1\xa2 a".force_encoding("euc-jp") #=> 2 + * + * r = /a/u + * r.fixed_encoding? #=> true + * r.encoding #=> <Encoding:UTF-8> + * r =~ "\u{6666} a" #=> 2 + * r =~ "\xa1\xa2".force_encoding("euc-jp") # ArgumentError + * + * r = /\u{6666}/ + * r.fixed_encoding? #=> true + * r.encoding #=> <Encoding:UTF-8> + * r =~ "\u{6666} a" #=> 0 + * r =~ "\xa1\xa2".force_encoding("euc-jp") # ArgumentError + */ + static VALUE rb_reg_fixed_encoding_p(VALUE re) { |