Sha256: 61c3bb83a53a310727d97909c36c05352d4e47344989a907412577158c4207d3

Contents?: true

Size: 274 Bytes

Versions: 42

Compression:

Stored size: 274 Bytes

Contents

unless StringScanner.method_defined? :charpos
  class StringScanner
    def charpos
      if string.respond_to?(:byteslice)
        string.byteslice(0, pos).length
      else
        string.unpack("@0a#{pos}").first.force_encoding("UTF-8").length
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 2 rubygems

Version Path
truex-skylight-0.6.0 lib/sql_lexer/string_scanner.rb
skylight-0.7.0.beta.2 lib/sql_lexer/string_scanner.rb
skylight-0.7.0.beta.1 lib/sql_lexer/string_scanner.rb
skylight-0.6.2.beta.2 lib/sql_lexer/string_scanner.rb
skylight-0.6.1 lib/sql_lexer/string_scanner.rb
skylight-0.6.0 lib/sql_lexer/string_scanner.rb
skylight-0.6.0.beta.1 lib/sql_lexer/string_scanner.rb
skylight-0.5.2 lib/sql_lexer/string_scanner.rb
skylight-0.5.1 lib/sql_lexer/string_scanner.rb
skylight-0.5.0 lib/sql_lexer/string_scanner.rb
skylight-0.4.3 lib/sql_lexer/string_scanner.rb
skylight-0.5.0.beta1 lib/sql_lexer/string_scanner.rb
skylight-0.4.2 lib/sql_lexer/string_scanner.rb
skylight-0.4.1 lib/sql_lexer/string_scanner.rb
skylight-0.4.0 lib/sql_lexer/string_scanner.rb
skylight-0.4.0.beta2 lib/sql_lexer/string_scanner.rb
skylight-0.4.0.beta1 lib/sql_lexer/string_scanner.rb
skylight-0.4.0.alpha1 lib/sql_lexer/string_scanner.rb
skylight-0.3.21 lib/sql_lexer/string_scanner.rb
skylight-0.3.20 lib/sql_lexer/string_scanner.rb