Instantiate one fewer string in the rtl code
This commit is contained in:
parent
5768d3188a
commit
1a72be544f
1 changed files with 3 additions and 2 deletions
|
|
@ -44,8 +44,9 @@ class String
|
|||
end
|
||||
|
||||
def starts_with_rtl_char?(string = self)
|
||||
return false if string.strip.empty?
|
||||
char = string.strip.unpack('U*').first
|
||||
stripped = string.strip
|
||||
return false if stripped.empty?
|
||||
char = stripped.unpack('U*').first
|
||||
RTL_RANGES.each do |limit|
|
||||
return true if char >= limit[0] && char <= limit[1]
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue