Sha256: b532eb2359b4919ed2fd885f43b8c6c2f499a27b14a19b3509e5a6fbb64f9d96

Contents?: true

Size: 545 Bytes

Versions: 11

Compression:

Stored size: 545 Bytes

Contents

# Monkey patch to add stubbed string encoding functions to Ruby 1.8

class String
    def force_encoding(encoding)
      @encoding = encoding
      self
    end
  
    def encoding
      @encoding ||= Encoding::ASCII_8BIT
    end
  
    def encode(encoding)
      new = dup
      new.force_encoding(encoding)
    end
  end
  
  class Encoding
    attr_reader :name
  
    def initialize(name)
      @name = name
    end
  
    def to_s
      @name
    end
  
    UTF_8 = Encoding.new('UTF-8')
    ASCII_8BIT = Encoding.new('ASCII-8BIT')
  end
  

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
qubitro-mqtt-0.0.11 lib/qubitro-mqtt/patches/string_encoding.rb
qubitro-mqtt-0.0.10 lib/qubitro-mqtt/patches/string_encoding.rb
qubitro-mqtt-0.0.9 lib/qubitro-mqtt/patches/string_encoding.rb
qubitro-mqtt-0.0.8 lib/qubitro-mqtt/patches/string_encoding.rb
qubitro-mqtt-0.0.7 lib/qubitro-mqtt/patches/string_encoding.rb
qubitro-mqtt-0.0.6 lib/qubitro-mqtt/patches/string_encoding.rb
qubitro-mqtt-0.0.5 lib/qubitro-mqtt/patches/string_encoding.rb
qubitro-mqtt-0.0.4 lib/qubitro-mqtt/patches/string_encoding.rb
qubitro-mqtt-0.0.3 lib/qubitro-mqtt/patches/string_encoding.rb
qubitro-mqtt-0.0.2 lib/qubitro-mqtt/patches/string_encoding.rb
qubitro-mqtt-0.0.1 lib/qubitro-mqtt/patches/string_encoding.rb