Class: ProtocolBuffers::Field::BytesField

Inherits:
ProtocolBuffers::Field show all
Includes:
WireFormats::LENGTH_DELIMITED
Defined in:
lib/protocol_buffers/runtime/field.rb

Direct Known Subclasses

StringField

Instance Attribute Summary

Attributes inherited from ProtocolBuffers::Field

#name, #otype, #tag

Instance Method Summary collapse

Methods included from WireFormats::LENGTH_DELIMITED

#deserialize, #wire_type

Methods inherited from ProtocolBuffers::Field

#add_methods_to, #check_valid, #check_value, create, #deserialize, #initialize, #inspect_value, #repeated?, #serialize

Constructor Details

This class inherits a constructor from ProtocolBuffers::Field

Instance Method Details

#default_valueObject



253
254
255
# File 'lib/protocol_buffers/runtime/field.rb', line 253

def default_value
  @default_value || @default_value = (@opts[:default] || "").freeze
end

#valid_type?(value) ⇒ Boolean

Returns:

  • (Boolean)


249
250
251
# File 'lib/protocol_buffers/runtime/field.rb', line 249

def valid_type?(value)
  value.is_a?(String)
end