Class: ProtocolBuffers::Field::FloatField

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

Instance Attribute Summary

Attributes inherited from ProtocolBuffers::Field

#name, #otype, #tag

Instance Method Summary collapse

Methods included from WireFormats::FIXED32

#deserialize, #serialize, #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



455
456
457
# File 'lib/protocol_buffers/runtime/field.rb', line 455

def default_value
  @opts[:default] || 0.0
end

#pack_codeObject



447
448
449
# File 'lib/protocol_buffers/runtime/field.rb', line 447

def pack_code
  'e'
end

#valid_type?(value) ⇒ Boolean

Returns:

  • (Boolean)


451
452
453
# File 'lib/protocol_buffers/runtime/field.rb', line 451

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