Permalink
Browse files

Modifying AdditionalDateFormatSelector to return the correct format o…

…n exact format match
  • Loading branch information...
1 parent f0f8550 commit dc3f10d896ed1770dbd50a2b8f731c4b66dff568 Cameron Dutro committed Feb 12, 2013
View
@@ -1,3 +1,7 @@
+== 2.1.1
+
+* Modified AdditionalDateFormatSelector to return the correct format on exact format match.
+
== 2.1.0
* Significant performance improvements (memoization, resource preloading).
@@ -17,9 +17,13 @@ def find_closest(goal_pattern)
nil
else
cache_key = TwitterCldr::Utils.compute_cache_key(goal_pattern)
- pattern_cache[cache_key] ||= rank(goal_pattern).min do |(p1, score1), (p2, score2)|
- score1 <=> score2
- end.first
+ pattern_cache[cache_key] ||= if @pattern_hash.include?(goal_pattern)
+ @pattern_hash[goal_pattern]
+ else
+ rank(goal_pattern).min do |(p1, score1), (p2, score2)|
+ score1 <=> score2
+ end.first
+ end
end
end
@@ -4,5 +4,5 @@
# http://www.apache.org/licenses/LICENSE-2.0
module TwitterCldr
- VERSION = "2.1.0"
+ VERSION = "2.1.1"
end

0 comments on commit dc3f10d

Please sign in to comment.