Module: ActiveRemote::Serializers::Protobuf

Extended by:
ActiveSupport::Concern
Included in:
RPCAdapters::ProtobufAdapter
Defined in:
lib/active_remote/serializers/protobuf.rb

Defined Under Namespace

Modules: ClassMethods Classes: Field, Fields

Constant Summary collapse

FIELD_TYPE_MAP =
{
  ::Protobuf::Field::BoolField => :boolean,
  ::Protobuf::Field::BytesField => :string,
  ::Protobuf::Field::DoubleField => :float,
  ::Protobuf::Field::Fixed32Field => :float,
  ::Protobuf::Field::Fixed64Field => :float,
  ::Protobuf::Field::FloatField => :float,
  ::Protobuf::Field::Int32Field => :integer,
  ::Protobuf::Field::Int64Field => :integer,
  ::Protobuf::Field::Sfixed32Field => :float,
  ::Protobuf::Field::Sfixed64Field => :float,
  ::Protobuf::Field::Sint32Field => :integer,
  ::Protobuf::Field::Sint64Field => :integer,
  ::Protobuf::Field::StringField => :string,
  ::Protobuf::Field::Uint32Field => :integer,
  ::Protobuf::Field::Uint64Field => :integer
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.type_name_for_field(field) ⇒ Object



24
25
26
# File 'lib/active_remote/serializers/protobuf.rb', line 24

def self.type_name_for_field(field)
  FIELD_TYPE_MAP[field.type_class]
end

Instance Method Details

#fields_from_attributes(message_class, attributes) ⇒ Object



34
35
36
# File 'lib/active_remote/serializers/protobuf.rb', line 34

def fields_from_attributes(message_class, attributes)
  Fields.from_attributes(message_class, attributes)
end