lib/active_support/multibyte/chars.rb in activesupport-3.1.0.rc4 vs lib/active_support/multibyte/chars.rb in activesupport-3.1.0.rc5
- old
+ new
@@ -329,11 +329,10 @@
# Limit the byte size of the string to a number of bytes without breaking characters. Usable
# when the storage for a string is limited for some reason.
#
# Example:
- # s = 'こんにちは'
- # s.mb_chars.limit(7) # => "こに"
+ # 'こんにちは'.mb_chars.limit(7).to_s # => "こん"
def limit(limit)
slice(0...translate_offset(limit))
end
# Convert characters in the string to uppercase.