class String

Monkey patch to add stubbed string encoding functions to Ruby 1.8

Public Instance Methods

encode(encoding) click to toggle source
# File lib/mqttbridge/patches/string_encoding.rb, line 13
def encode(encoding)
  new = self.dup
  new.force_encoding(encoding)
end
encoding() click to toggle source
# File lib/mqttbridge/patches/string_encoding.rb, line 9
def encoding
  @encoding ||= Encoding::ASCII_8BIT
end
force_encoding(encoding) click to toggle source
# File lib/mqttbridge/patches/string_encoding.rb, line 4
def force_encoding(encoding)
  @encoding = encoding
  self
end