class TJSON::DataType::String
Unicode String
type
Public Instance Methods
decode(str)
click to toggle source
# File lib/tjson/datatype/string.rb, line 11 def decode(str) raise TJSON::TypeError, "expected String, got #{str.class}: #{str.inspect}" unless str.is_a?(::String) raise TJSON::EncodingError, "expected UTF-8, got #{str.encoding.inspect}" unless str.encoding == Encoding::UTF_8 str end
encode(obj)
click to toggle source
# File lib/tjson/datatype/string.rb, line 17 def encode(obj) obj.to_s end
tag()
click to toggle source
# File lib/tjson/datatype/string.rb, line 7 def tag "s" end