Module: Serega::SeregaPlugins::Batch::SeregaBatchLoader::InstanceMethods
- Included in:
- Serega::SeregaPlugins::Batch::SeregaBatchLoader
- Defined in:
- lib/serega/plugins/batch/lib/loader.rb
Overview
Batch Loader instance methods
Instance Attribute Summary collapse
- #object_serializer ⇒ Serega::SeregaObjectSerializer readonly
- #point ⇒ Serega::SeregaMapPoint readonly
Instance Method Summary collapse
-
#initialize(object_serializer, point) ⇒ Serega::SeregaPlugins::Batch::SeregaBatchLoader
Initializes new SeregaBatchLoader.
-
#load ⇒ void
Loads this batch and assigns values to remembered containers.
-
#remember(key, container) ⇒ void
Remembers key and hash container where value for this key must be inserted.
Instance Attribute Details
#object_serializer ⇒ Serega::SeregaObjectSerializer (readonly)
19 20 21 |
# File 'lib/serega/plugins/batch/lib/loader.rb', line 19 def object_serializer @object_serializer end |
#point ⇒ Serega::SeregaMapPoint (readonly)
16 17 18 |
# File 'lib/serega/plugins/batch/lib/loader.rb', line 16 def point @point end |
Instance Method Details
#initialize(object_serializer, point) ⇒ Serega::SeregaPlugins::Batch::SeregaBatchLoader
Initializes new SeregaBatchLoader
29 30 31 32 |
# File 'lib/serega/plugins/batch/lib/loader.rb', line 29 def initialize(object_serializer, point) @object_serializer = object_serializer @point = point end |
#load ⇒ void
This method returns an undefined value.
Loads this batch and assigns values to remembered containers
51 52 53 54 55 56 57 58 59 |
# File 'lib/serega/plugins/batch/lib/loader.rb', line 51 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) ⇒ void
This method returns an undefined value.
Remembers key and hash container where value for this key must be inserted
42 43 44 |
# File 'lib/serega/plugins/batch/lib/loader.rb', line 42 def remember(key, container) (keys[key] ||= []) << container end |