Instantiate one fewer string in the rtl code

This commit is contained in:
Raphael Sofaer 2011-08-06 12:18:21 -07:00
parent 5768d3188a
commit 1a72be544f

View file

@ -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