Skip to content

Commit 09d7f35

Browse files
flavorjonesnobu
andauthored
Prefer String#ord to #codepoints[0] (#1220)
Co-authored-by: Nobuyoshi Nakada <[email protected]>
1 parent 9ced6d5 commit 09d7f35

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/rdoc/code_object/method_attr.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ def <=>(other)
114114
return unless other.respond_to?(:singleton) &&
115115
other.respond_to?(:name)
116116

117-
[@singleton ? 0 : 1, name_codepoint_range, name] <=>
118-
[other.singleton ? 0 : 1, other.name_codepoint_range, other.name]
117+
[@singleton ? 0 : 1, name_ord_range, name] <=>
118+
[other.singleton ? 0 : 1, other.name_ord_range, other.name]
119119
end
120120

121121
def == other # :nodoc:
@@ -415,8 +415,8 @@ def to_s # :nodoc:
415415
end
416416
end
417417

418-
def name_codepoint_range # :nodoc:
419-
case name.codepoints[0]
418+
def name_ord_range # :nodoc:
419+
case name.ord
420420
when 0..64 # anything below "A"
421421
1
422422
when 91..96 # the symbols between "Z" and "a"

0 commit comments

Comments
 (0)