mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
[ruby/rdoc] Prefer String#ord to #codepoints[0]
(https://github.com/ruby/rdoc/pull/1220)
09d7f35420
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
This commit is contained in:
parent
4cce246d86
commit
af5c34fb0b
1 changed files with 4 additions and 4 deletions
|
@ -114,8 +114,8 @@ class RDoc::MethodAttr < RDoc::CodeObject
|
||||||
return unless other.respond_to?(:singleton) &&
|
return unless other.respond_to?(:singleton) &&
|
||||||
other.respond_to?(:name)
|
other.respond_to?(:name)
|
||||||
|
|
||||||
[@singleton ? 0 : 1, name_codepoint_range, name] <=>
|
[@singleton ? 0 : 1, name_ord_range, name] <=>
|
||||||
[other.singleton ? 0 : 1, other.name_codepoint_range, other.name]
|
[other.singleton ? 0 : 1, other.name_ord_range, other.name]
|
||||||
end
|
end
|
||||||
|
|
||||||
def == other # :nodoc:
|
def == other # :nodoc:
|
||||||
|
@ -415,8 +415,8 @@ class RDoc::MethodAttr < RDoc::CodeObject
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def name_codepoint_range # :nodoc:
|
def name_ord_range # :nodoc:
|
||||||
case name.codepoints[0]
|
case name.ord
|
||||||
when 0..64 # anything below "A"
|
when 0..64 # anything below "A"
|
||||||
1
|
1
|
||||||
when 91..96 # the symbols between "Z" and "a"
|
when 91..96 # the symbols between "Z" and "a"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue