Class: Protobuf::Field::BaseFieldObjectDefinitions::RepeatedPackedSetMethod
- Inherits:
-
Object
- Object
- Protobuf::Field::BaseFieldObjectDefinitions::RepeatedPackedSetMethod
- Defined in:
- lib/protobuf/field/base_field_object_definitions.rb
Instance Method Summary collapse
- #call(message_instance, bytes) ⇒ Object
-
#initialize(selph) ⇒ RepeatedPackedSetMethod
constructor
A new instance of RepeatedPackedSetMethod.
Constructor Details
#initialize(selph) ⇒ RepeatedPackedSetMethod
Returns a new instance of RepeatedPackedSetMethod.
154 155 156 157 158 |
# File 'lib/protobuf/field/base_field_object_definitions.rb', line 154 def initialize(selph) @selph = selph @name = selph.name @wire_type = selph.wire_type end |
Instance Method Details
#call(message_instance, bytes) ⇒ Object
160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/protobuf/field/base_field_object_definitions.rb', line 160 def call(, bytes) array = [@name] stream = ::StringIO.new(bytes) if @wire_type == ::Protobuf::WireType::VARINT array << @selph.decode(Varint.decode(stream)) until stream.eof? elsif @wire_type == ::Protobuf::WireType::FIXED64 array << @selph.decode(stream.read(8)) until stream.eof? elsif @wire_type == ::Protobuf::WireType::FIXED32 array << @selph.decode(stream.read(4)) until stream.eof? end end |