From 1a72be544f0838fb70c232eef8c79812ba81e43c Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Sat, 6 Aug 2011 12:18:21 -0700 Subject: [PATCH] Instantiate one fewer string in the rtl code --- lib/direction_detector.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/direction_detector.rb b/lib/direction_detector.rb index 0ea8703cb..d3f9c762f 100644 --- a/lib/direction_detector.rb +++ b/lib/direction_detector.rb @@ -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