Class: Protobuf::Field::StringField

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

Instance Attribute Summary

Attributes inherited from BaseField

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

Instance Method Summary collapse

Methods inherited from BytesField

#acceptable?, default, #encode, #wire_type

Methods inherited from BaseField

#acceptable?, default, descriptor, #descriptor, #encode, #initialize, #initialized?, #max, #merge, #min, #optional?, #packed?, #ready?, #repeated?, #required?, #set, #to_s

Constructor Details

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

Instance Method Details

#decode(bytes) ⇒ Object



354
355
356
357
# File 'lib/protobuf/message/field.rb', line 354

def decode(bytes)
  bytes.force_encoding('UTF-8') if bytes.respond_to?(:force_encoding)
  bytes
end