Sha256: 5cd233eb0c267f15ba71d29520f8d1bda9098bf850920f95d106659c30d49ead

Contents?: true

Size: 383 Bytes

Versions: 6

Compression:

Stored size: 383 Bytes

Contents

class String
  # Wraps your string in an UTF8-aware version of String
  def as_utf8
    String::UTF8.new(self)
  end

  class UTF8 < ::String
    # Gives you access to the raw non-UTF8-aware version of the string
    def as_raw
      ::String.new(self)
    end

    alias :size  :length
    alias :chars :each_char
    alias :slice :[]
    alias :codepoints :each_codepoint
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
utf8-0.1.8 lib/utf8/string.rb
utf8-0.1.7 lib/utf8/string.rb
utf8-0.1.6 lib/utf8/string.rb
utf8-0.1.5 lib/utf8/string.rb
utf8-0.1.4 lib/utf8/string.rb
utf8-0.1.3 lib/utf8/string.rb