We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ddee6f2 commit dabcfc4Copy full SHA for dabcfc4
activesupport/lib/active_support/core_ext/string/filters.rb
@@ -41,15 +41,15 @@ def squish!
41
def truncate(truncate_at, options = {})
42
return dup unless length > truncate_at
43
44
- options[:omission] ||= '...'
45
- length_with_room_for_omission = truncate_at - options[:omission].length
+ omission = options[:omission] || '...'
+ length_with_room_for_omission = truncate_at - omission.length
46
stop = \
47
if options[:separator]
48
rindex(options[:separator], length_with_room_for_omission) || length_with_room_for_omission
49
else
50
length_with_room_for_omission
51
end
52
53
- "#{self[0, stop]}#{options[:omission]}"
+ "#{self[0, stop]}#{omission}"
54
55
0 commit comments