Class: Protobuf::Field::DoubleField

Inherits:
FloatField show all
Defined in:
lib/protobuf/field/double_field.rb

Constant Summary

Constants inherited from BaseField

BaseField::PACKED_TYPES

Instance Attribute Summary

Attributes inherited from BaseField

#message_class, #name, #options, #rule, #tag, #type_class

Instance Method Summary collapse

Methods inherited from FloatField

#acceptable?, #coerce!, default

Methods inherited from BaseField

#acceptable?, #coerce!, default, #default, #default_value, #deprecated?, #enum?, #extension?, #getter, #initialize, #message?, #optional?, #packed?, #repeated?, #repeated_message?, #required?, #set, #setter, #to_s

Methods included from Logging

initialize_logger, #log_exception, #log_signature, #logger, #sign_message

Constructor Details

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

Instance Method Details

#decode(bytes) ⇒ Object

Public Instance Methods



11
12
13
# File 'lib/protobuf/field/double_field.rb', line 11

def decode(bytes)
  bytes.unpack('E').first
end

#encode(value) ⇒ Object



15
16
17
# File 'lib/protobuf/field/double_field.rb', line 15

def encode(value)
  [value].pack('E')
end

#wire_typeObject



19
20
21
# File 'lib/protobuf/field/double_field.rb', line 19

def wire_type
  WireType::FIXED64
end