Skip to content

Commit 350df4f

Browse files
[DOC] Tweaks for Case Mapping doc
1 parent 38993ef commit 350df4f

File tree

2 files changed

+30
-40
lines changed

2 files changed

+30
-40
lines changed

doc/case_mapping.rdoc

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Context-dependent case mapping as described in
3737
{Table 3-17 (Context Specification for Casing) of the Unicode standard}[https://www.unicode.org/versions/latest/ch03.pdf]
3838
is currently not supported.
3939

40-
In most cases, case conversions of a string have the same number of characters.
40+
In most cases, the case conversion of a string has the same number of characters as before.
4141
There are exceptions (see also +:fold+ below):
4242

4343
s = "\u00DF" # => "ß"
@@ -58,25 +58,18 @@ Case changes may not be reversible:
5858
s.downcase.upcase # => "HELLO WORLD!" # Different from original s.
5959

6060
Case changing methods may not maintain Unicode normalization.
61-
See String#unicode_normalize).
61+
See String#unicode_normalize.
6262

63-
== Options for Case Mapping
63+
== Case Mappings
6464

6565
Except for +casecmp+ and +casecmp?+,
6666
each of the case-mapping methods listed above
67-
accepts optional arguments, <tt>*options</tt>.
67+
accepts an optional argument, <tt>mapping</tt>.
6868

69-
The arguments may be:
69+
The argument is one of:
7070

71-
- +:ascii+ only.
72-
- +:fold+ only.
73-
- +:turkic+ or +:lithuanian+ or both.
74-
75-
The options:
76-
77-
- +:ascii+:
78-
ASCII-only mapping:
79-
uppercase letters ('A'..'Z') are mapped to lowercase letters ('a'..'z);
71+
- +:ascii+: ASCII-only mapping.
72+
Uppercase letters ('A'..'Z') are mapped to lowercase letters ('a'..'z);
8073
other characters are not changed
8174

8275
s = "Foo \u00D8 \u00F8 Bar" # => "Foo Ø ø Bar"
@@ -85,8 +78,8 @@ The options:
8578
s.upcase(:ascii) # => "FOO Ø ø BAR"
8679
s.downcase(:ascii) # => "foo Ø ø bar"
8780

88-
- +:turkic+:
89-
Full Unicode case mapping, adapted for the Turkic languages
81+
- +:turkic+: Full Unicode case mapping.
82+
For the Turkic languages
9083
that distinguish dotted and dotless I, for example Turkish and Azeri.
9184

9285
s = 'Türkiye' # => "Türkiye"
@@ -97,11 +90,8 @@ The options:
9790
s.downcase # => "türkiye"
9891
s.downcase(:turkic) # => "türkıye" # No dot above.
9992

100-
- +:lithuanian+:
101-
Not yet implemented.
102-
10393
- +:fold+ (available only for String#downcase, String#downcase!,
104-
and Symbol#downcase):
94+
and Symbol#downcase).
10595
Unicode case folding,
10696
which is more far-reaching than Unicode case mapping.
10797

string.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8056,7 +8056,7 @@ upcase_single(VALUE str)
80568056

80578057
/*
80588058
* call-seq:
8059-
* upcase!(*options) -> self or nil
8059+
* upcase!(mapping) -> self or nil
80608060
*
80618061
* Upcases the characters in +self+;
80628062
* returns +self+ if any changes were made, +nil+ otherwise:
@@ -8066,7 +8066,7 @@ upcase_single(VALUE str)
80668066
* s # => "HELLO WORLD!"
80678067
* s.upcase! # => nil
80688068
*
8069-
* The casing may be affected by the given +options+;
8069+
* The casing may be affected by the given +mapping+;
80708070
* see {Case Mapping}[rdoc-ref:case_mapping.rdoc].
80718071
*
80728072
* Related: String#upcase, String#downcase, String#downcase!.
@@ -8098,14 +8098,14 @@ rb_str_upcase_bang(int argc, VALUE *argv, VALUE str)
80988098

80998099
/*
81008100
* call-seq:
8101-
* upcase(*options) -> string
8101+
* upcase(mapping) -> string
81028102
*
81038103
* Returns a string containing the upcased characters in +self+:
81048104
*
81058105
* s = 'Hello World!' # => "Hello World!"
81068106
* s.upcase # => "HELLO WORLD!"
81078107
*
8108-
* The casing may be affected by the given +options+;
8108+
* The casing may be affected by the given +mapping+;
81098109
* see {Case Mapping}[rdoc-ref:case_mapping.rdoc].
81108110
*
81118111
* Related: String#upcase!, String#downcase, String#downcase!.
@@ -8158,7 +8158,7 @@ downcase_single(VALUE str)
81588158

81598159
/*
81608160
* call-seq:
8161-
* downcase!(*options) -> self or nil
8161+
* downcase!(mapping) -> self or nil
81628162
*
81638163
* Downcases the characters in +self+;
81648164
* returns +self+ if any changes were made, +nil+ otherwise:
@@ -8168,7 +8168,7 @@ downcase_single(VALUE str)
81688168
* s # => "hello world!"
81698169
* s.downcase! # => nil
81708170
*
8171-
* The casing may be affected by the given +options+;
8171+
* The casing may be affected by the given +mapping+;
81728172
* see {Case Mapping}[rdoc-ref:case_mapping.rdoc].
81738173
*
81748174
* Related: String#downcase, String#upcase, String#upcase!.
@@ -8200,14 +8200,14 @@ rb_str_downcase_bang(int argc, VALUE *argv, VALUE str)
82008200

82018201
/*
82028202
* call-seq:
8203-
* downcase(*options) -> string
8203+
* downcase(mapping) -> string
82048204
*
82058205
* Returns a string containing the downcased characters in +self+:
82068206
*
82078207
* s = 'Hello World!' # => "Hello World!"
82088208
* s.downcase # => "hello world!"
82098209
*
8210-
* The casing may be affected by the given +options+;
8210+
* The casing may be affected by the given +mapping+;
82118211
* see {Case Mapping}[rdoc-ref:case_mapping.rdoc].
82128212
*
82138213
* Related: String#downcase!, String#upcase, String#upcase!.
@@ -8242,7 +8242,7 @@ rb_str_downcase(int argc, VALUE *argv, VALUE str)
82428242

82438243
/*
82448244
* call-seq:
8245-
* capitalize!(*options) -> self or nil
8245+
* capitalize!(mapping) -> self or nil
82468246
*
82478247
* Upcases the first character in +self+;
82488248
* downcases the remaining characters;
@@ -8253,7 +8253,7 @@ rb_str_downcase(int argc, VALUE *argv, VALUE str)
82538253
* s # => "Hello world!"
82548254
* s.capitalize! # => nil
82558255
*
8256-
* The casing may be affected by the given +options+;
8256+
* The casing may be affected by the given +mapping+;
82578257
* see {Case Mapping}[rdoc-ref:case_mapping.rdoc].
82588258
*
82598259
* Related: String#capitalize.
@@ -8282,7 +8282,7 @@ rb_str_capitalize_bang(int argc, VALUE *argv, VALUE str)
82828282

82838283
/*
82848284
* call-seq:
8285-
* capitalize(*options) -> string
8285+
* capitalize(mapping) -> string
82868286
*
82878287
* Returns a string containing the characters in +self+;
82888288
* the first character is upcased;
@@ -8291,7 +8291,7 @@ rb_str_capitalize_bang(int argc, VALUE *argv, VALUE str)
82918291
* s = 'hello World!' # => "hello World!"
82928292
* s.capitalize # => "Hello world!"
82938293
*
8294-
* The casing may be affected by the given +options+;
8294+
* The casing may be affected by the given +mapping+;
82958295
* see {Case Mapping}[rdoc-ref:case_mapping.rdoc].
82968296
*
82978297
* Related: String#capitalize!.
@@ -8321,7 +8321,7 @@ rb_str_capitalize(int argc, VALUE *argv, VALUE str)
83218321

83228322
/*
83238323
* call-seq:
8324-
* swapcase!(*options) -> self or nil
8324+
* swapcase!(mapping) -> self or nil
83258325
*
83268326
* Upcases each lowercase character in +self+;
83278327
* downcases uppercase character;
@@ -8332,7 +8332,7 @@ rb_str_capitalize(int argc, VALUE *argv, VALUE str)
83328332
* s # => "hELLO wORLD!"
83338333
* ''.swapcase! # => nil
83348334
*
8335-
* The casing may be affected by the given +options+;
8335+
* The casing may be affected by the given +mapping+;
83368336
* see {Case Mapping}[rdoc-ref:case_mapping.rdoc].
83378337
*
83388338
* Related: String#swapcase.
@@ -8360,7 +8360,7 @@ rb_str_swapcase_bang(int argc, VALUE *argv, VALUE str)
83608360

83618361
/*
83628362
* call-seq:
8363-
* swapcase(*options) -> string
8363+
* swapcase(mapping) -> string
83648364
*
83658365
* Returns a string containing the characters in +self+, with cases reversed;
83668366
* each uppercase character is downcased;
@@ -8369,7 +8369,7 @@ rb_str_swapcase_bang(int argc, VALUE *argv, VALUE str)
83698369
* s = 'Hello World!' # => "Hello World!"
83708370
* s.swapcase # => "hELLO wORLD!"
83718371
*
8372-
* The casing may be affected by the given +options+;
8372+
* The casing may be affected by the given +mapping+;
83738373
* see {Case Mapping}[rdoc-ref:case_mapping.rdoc].
83748374
*
83758375
* Related: String#swapcase!.
@@ -12482,7 +12482,7 @@ sym_empty(VALUE sym)
1248212482

1248312483
/*
1248412484
* call-seq:
12485-
* upcase(*options) -> symbol
12485+
* upcase(mapping) -> symbol
1248612486
*
1248712487
* Equivalent to <tt>sym.to_s.upcase.to_sym</tt>.
1248812488
*
@@ -12498,7 +12498,7 @@ sym_upcase(int argc, VALUE *argv, VALUE sym)
1249812498

1249912499
/*
1250012500
* call-seq:
12501-
* downcase(*options) -> symbol
12501+
* downcase(mapping) -> symbol
1250212502
*
1250312503
* Equivalent to <tt>sym.to_s.downcase.to_sym</tt>.
1250412504
*
@@ -12516,7 +12516,7 @@ sym_downcase(int argc, VALUE *argv, VALUE sym)
1251612516

1251712517
/*
1251812518
* call-seq:
12519-
* capitalize(*options) -> symbol
12519+
* capitalize(mapping) -> symbol
1252012520
*
1252112521
* Equivalent to <tt>sym.to_s.capitalize.to_sym</tt>.
1252212522
*
@@ -12532,7 +12532,7 @@ sym_capitalize(int argc, VALUE *argv, VALUE sym)
1253212532

1253312533
/*
1253412534
* call-seq:
12535-
* swapcase(*options) -> symbol
12535+
* swapcase(mapping) -> symbol
1253612536
*
1253712537
* Equivalent to <tt>sym.to_s.swapcase.to_sym</tt>.
1253812538
*

0 commit comments

Comments
 (0)