Class: Protobuf::Field::BaseFieldObjectDefinitions::MapSetMethod
- Inherits:
-
Object
- Object
- Protobuf::Field::BaseFieldObjectDefinitions::MapSetMethod
- Defined in:
- lib/protobuf/field/base_field_object_definitions.rb
Instance Method Summary collapse
- #call(message_instance, bytes) ⇒ Object
-
#initialize(selph) ⇒ MapSetMethod
constructor
A new instance of MapSetMethod.
Constructor Details
#initialize(selph) ⇒ MapSetMethod
Returns a new instance of MapSetMethod.
127 128 129 130 |
# File 'lib/protobuf/field/base_field_object_definitions.rb', line 127 def initialize(selph) @selph = selph @name = selph.name end |
Instance Method Details
#call(message_instance, bytes) ⇒ Object
132 133 134 135 136 137 138 139 |
# File 'lib/protobuf/field/base_field_object_definitions.rb', line 132 def call(, bytes) hash = [@name] entry = @selph.decode(bytes) # decoded value could be nil for an # enum value that is not recognized hash[entry.key] = entry.value unless entry.value.nil? hash[entry.key] end |