Module: Serega::SeregaPlugins::Batch::SeregaBatchLoader::InstanceMethods

Included in:
Serega::SeregaPlugins::Batch::SeregaBatchLoader
Defined in:
lib/serega/plugins/batch/lib/loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#object_serializerObject (readonly)

Returns the value of attribute object_serializer.



8
9
10
# File 'lib/serega/plugins/batch/lib/loader.rb', line 8

def object_serializer
  @object_serializer
end

#pointObject (readonly)

Returns the value of attribute point.



8
9
10
# File 'lib/serega/plugins/batch/lib/loader.rb', line 8

def point
  @point
end

Instance Method Details

#initialize(object_serializer, point) ⇒ Object



10
11
12
13
# File 'lib/serega/plugins/batch/lib/loader.rb', line 10

def initialize(object_serializer, point)
  @object_serializer = object_serializer
  @point = point
end

#loadObject



19
20
21
22
23
24
25
26
27
# File 'lib/serega/plugins/batch/lib/loader.rb', line 19

def load
  keys_values = keys_values()

  each_key do |key, container|
    value = keys_values.fetch(key) { point.batch.default_value }
    final_value = object_serializer.__send__(:final_value, value, point)
    object_serializer.__send__(:attach_final_value, final_value, point, container)
  end
end

#remember(key, container) ⇒ Object



15
16
17
# File 'lib/serega/plugins/batch/lib/loader.rb', line 15

def remember(key, container)
  (keys[key] ||= []) << container
end