Skip to content

Commit 4536170

Browse files
committed
Speed up String#truncate
Benchmark: user system total real old 1.550000 0.040000 1.590000 ( 1.585866) new 1.250000 0.040000 1.290000 ( 1.287693)
1 parent af4b654 commit 4536170

File tree

1 file changed

+1
-1
lines changed
  • activesupport/lib/active_support/core_ext/string

1 file changed

+1
-1
lines changed

activesupport/lib/active_support/core_ext/string/filters.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ def truncate(truncate_at, options = {})
5050
length_with_room_for_omission
5151
end
5252

53-
"#{self[0...stop]}#{options[:omission]}"
53+
"#{self[0, stop]}#{options[:omission]}"
5454
end
5555
end

0 commit comments

Comments
 (0)