Bug #8729 ยป 0001-Fix-character-literals-in-documentation.patch
enum.c | ||
---|---|---|
*
|
||
* files = Dir["*"]
|
||
* sorted = files.sort { |a, b|
|
||
* test(?M, a) <=> test(?M, b)
|
||
* test(??M, a) <=> test(??M, b)
|
||
* }
|
||
* sorted #=> ["mon", "tues", "wed", "thurs"]
|
||
*
|
||
... | ... | |
* and then extract the filename from the result.
|
||
*
|
||
* sorted = Dir["*"].collect { |f|
|
||
* [test(?M, f), f]
|
||
* [test(??M, f), f]
|
||
* }.sort.collect { |f| f[1] }
|
||
* sorted #=> ["mon", "tues", "wed", "thurs"]
|
||
*
|
||
* This is exactly what <code>sort_by</code> does internally.
|
||
*
|
||
* sorted = Dir["*"].sort_by { |f| test(?M, f) }
|
||
* sorted = Dir["*"].sort_by { |f| test(??M, f) }
|
||
* sorted #=> ["mon", "tues", "wed", "thurs"]
|
||
*/
|
||
numeric.c | ||
---|---|---|
*
|
||
* Returns the +int+ itself.
|
||
*
|
||
* ?a.ord #=> 97
|
||
* ??a.ord #=> 97
|
||
*
|
||
* This method is intended for compatibility to character constant in Ruby
|
||
* 1.9.
|
string.c | ||
---|---|---|
* "hello".index('e') #=> 1
|
||
* "hello".index('lo') #=> 3
|
||
* "hello".index('a') #=> nil
|
||
* "hello".index(?e) #=> 1
|
||
* "hello".index(??e) #=> 1
|
||
* "hello".index(/[aeiou]/, -3) #=> 4
|
||
*/
|
||
... | ... | |
* "hello".rindex('e') #=> 1
|
||
* "hello".rindex('l') #=> 3
|
||
* "hello".rindex('a') #=> nil
|
||
* "hello".rindex(?e) #=> 1
|
||
* "hello".rindex(??e) #=> 1
|
||
* "hello".rindex(/[aeiou]/, -2) #=> 1
|
||
*/
|
||
... | ... | |
*
|
||
* "hello".include? "lo" #=> true
|
||
* "hello".include? "ol" #=> false
|
||
* "hello".include? ?h #=> true
|
||
* "hello".include? ??h #=> true
|
||
*/
|
||
static VALUE
|