instance method
limit
Ruby on Rails 3.0.20
Since v3.0.20Signature
limit(limit)
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) # => "こに"
Parameters
-
limitreq
Source
# File activesupport/lib/active_support/multibyte/chars.rb, line 335
def limit(limit)
slice(0...translate_offset(limit))
end
Defined in activesupport/lib/active_support/multibyte/chars.rb line 335
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Multibyte::Chars