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.
12 13 14 15 |
# File 'lib/dynamoid/persistence/import.rb', line 12 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
8 9 10 |
# File 'lib/dynamoid/persistence/import.rb', line 8 def self.call(model_class, array_of_attributes) new(model_class, array_of_attributes).call end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/dynamoid/persistence/import.rb', line 17 def call models = @array_of_attributes.map(&method(:build_model)) unless Dynamoid.config.backoff import(models) else import_with_backoff(models) end models.each { |d| d.new_record = false } models end |