Class: Dynamoid::Persistence::Import
- Inherits:
-
Object
- Object
- Dynamoid::Persistence::Import
- Defined in:
- lib/dynamoid/persistence/import.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(model_class, array_of_attributes) ⇒ Import
constructor
A new instance of Import.
Constructor Details
#initialize(model_class, array_of_attributes) ⇒ Import
Returns a new instance of Import.
13 14 15 16 |
# File 'lib/dynamoid/persistence/import.rb', line 13 def initialize(model_class, array_of_attributes) @model_class = model_class @array_of_attributes = array_of_attributes end |
Class Method Details
.call(model_class, array_of_attributes) ⇒ Object
9 10 11 |
# File 'lib/dynamoid/persistence/import.rb', line 9 def self.call(model_class, array_of_attributes) new(model_class, array_of_attributes).call end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/dynamoid/persistence/import.rb', line 18 def call models = @array_of_attributes.map(&method(:build_model)) unless Dynamoid.config.backoff import(models) else import_with_backoff(models) end models.each do |m| m.new_record = false m.clear_changes_information end models end |