instance method translate_offset

Ruby on Rails 5.2.8.1

Since v5.2.8.1 Last seen in v5.2.8.1 Private

Signature

translate_offset(byte_offset)

No documentation comment.

Parameters

byte_offset req
Source
# File activesupport/lib/active_support/multibyte/chars.rb, line 218
        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 218 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::Multibyte::Chars

Type at least 2 characters to search.

↑↓ navigate · open · esc close