instance method
translate_offset
Ruby on Rails 5.1.7
Since v5.1.7 Last seen in v5.2.8.1 Private — implementation detail, not part of the public APIAvailable in: v5.1.7 v5.2.8.1
Signature
translate_offset(byte_offset)
No documentation comment.
Parameters
-
byte_offsetreq
Source
# File activesupport/lib/active_support/multibyte/chars.rb, line 216
def translate_offset(byte_offset)
return nil if byte_offset.nil?
return 0 if @wrapped_string == ""
begin
@wrapped_string.byteslice(0...byte_offset).unpack("U*").length
rescue ArgumentError
byte_offset -= 1
retry
end
end
Defined in activesupport/lib/active_support/multibyte/chars.rb line 216
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Multibyte::Chars