lib/mqtt/patches/string_encoding.rb in mqtt-0.5.0 vs lib/mqtt/patches/string_encoding.rb in mqtt-0.6.0
- old
+ new
@@ -9,26 +9,24 @@
def encoding
@encoding ||= Encoding::ASCII_8BIT
end
def encode(encoding)
- new = self.dup
+ new = dup
new.force_encoding(encoding)
end
end
class Encoding
+ attr_reader :name
+
def initialize(name)
@name = name
end
def to_s
@name
end
-
- def name
- @name
- end
- UTF_8 = Encoding.new("UTF-8")
- ASCII_8BIT = Encoding.new("ASCII-8BIT")
+ UTF_8 = Encoding.new('UTF-8')
+ ASCII_8BIT = Encoding.new('ASCII-8BIT')
end