Class: Protobuf::Field::BaseFieldObjectDefinitions::MapValueFromValuesForSerialization
- Inherits:
-
Object
- Object
- Protobuf::Field::BaseFieldObjectDefinitions::MapValueFromValuesForSerialization
- Defined in:
- lib/protobuf/field/base_field_object_definitions.rb
Instance Method Summary collapse
- #call(values) ⇒ Object
-
#initialize(selph) ⇒ MapValueFromValuesForSerialization
constructor
A new instance of MapValueFromValuesForSerialization.
Constructor Details
#initialize(selph) ⇒ MapValueFromValuesForSerialization
Returns a new instance of MapValueFromValuesForSerialization.
463 464 465 466 467 |
# File 'lib/protobuf/field/base_field_object_definitions.rb', line 463 def initialize(selph) @selph = selph @fully_qualified_name = selph.fully_qualified_name @type_class = selph.type_class end |
Instance Method Details
#call(values) ⇒ Object
469 470 471 472 473 474 475 476 477 478 |
# File 'lib/protobuf/field/base_field_object_definitions.rb', line 469 def call(values) value = values[@fully_qualified_name] ||= ::Protobuf::Field::FieldHash.new(@selph) array = [] value.each do |k, v| array << @type_class.new(:key => k, :value => v) end array end |