class Protobuf::Field::BaseFieldObjectDefinitions::MapSetField
Public Class Methods
new(selph)
click to toggle source
# File lib/protobuf/field/base_field_object_definitions.rb, line 201 def initialize(selph) @selph = selph @tag = selph.tag @fully_qualified_name = selph.fully_qualified_name end
Public Instance Methods
call(values, value, _ignore_nil_for_repeated, _message_instance)
click to toggle source
# File lib/protobuf/field/base_field_object_definitions.rb, line 207 def call(values, value, _ignore_nil_for_repeated, _message_instance) unless value.is_a?(Hash) fail TypeError, <<-TYPE_ERROR Expected map value Got '#{value.class}' for map protobuf field #{@selph.name} TYPE_ERROR end if value.empty? values.delete(@fully_qualified_name) else values[@fully_qualified_name] ||= ::Protobuf::Field::FieldHash.new(@selph) values[@fully_qualified_name].replace(value) end end