Class: Protobuf::Field::StringField

Inherits:
BytesField show all
Defined in:
lib/protobuf/message/field.rb

Instance Attribute Summary

Attributes inherited from BaseField

#default, #message_class, #name, #rule, #tag, #type

Instance Method Summary collapse

Methods inherited from BytesField

#acceptable?, default, #encode, #wire_type

Methods inherited from BaseField

#acceptable?, #clear, default, #default_value, descriptor, #descriptor, #error_message, #get, #initialize, #initialized?, #max, #merge, #merge_array, #merge_value, #min, #optional?, #ready?, #repeated?, #required?, #set, #to_s, #typed_default_value

Constructor Details

This class inherits a constructor from Protobuf::Field::BaseField

Instance Method Details

#decode(bytes) ⇒ Object



304
305
306
307
308
# File 'lib/protobuf/message/field.rb', line 304

def decode(bytes)
  message = bytes.pack('C*')
  message.force_encoding('UTF-8') if message.respond_to?(:force_encoding)
  message
end