lib/active_support/multibyte/chars.rb in activesupport-6.0.2.2 vs lib/active_support/multibyte/chars.rb in activesupport-6.0.3.rc1
- old
+ new
@@ -120,11 +120,11 @@
# characters. Usable when the storage for a string is limited for some
# reason.
#
# 'こんにちは'.mb_chars.limit(7).to_s # => "こん"
def limit(limit)
- truncate_bytes(limit, omission: nil)
+ chars(@wrapped_string.truncate_bytes(limit, omission: nil))
end
# Capitalizes the first letter of every word, when possible.
#
# "ÉL QUE SE ENTERÓ".mb_chars.titleize.to_s # => "Él Que Se Enteró"
@@ -205,10 +205,9 @@
self
end
end
private
-
def chars(string)
self.class.new(string)
end
end
end