Class: CloneKit::Strategies::Synchronous
- Inherits:
-
Object
- Object
- CloneKit::Strategies::Synchronous
- Defined in:
- lib/clone_kit/strategies/synchronous.rb
Instance Attribute Summary collapse
-
#operation ⇒ Object
Returns the value of attribute operation.
Instance Method Summary collapse
- #all_batches_complete ⇒ Object
- #clone_next_batch(model_specs, complete_handler) ⇒ Object
-
#initialize(operation) ⇒ Synchronous
constructor
A new instance of Synchronous.
Constructor Details
#initialize(operation) ⇒ Synchronous
Returns a new instance of Synchronous.
6 7 8 |
# File 'lib/clone_kit/strategies/synchronous.rb', line 6 def initialize(operation) self.operation = operation end |
Instance Attribute Details
#operation ⇒ Object
Returns the value of attribute operation.
30 31 32 |
# File 'lib/clone_kit/strategies/synchronous.rb', line 30 def operation @operation end |
Instance Method Details
#all_batches_complete ⇒ Object
10 11 12 |
# File 'lib/clone_kit/strategies/synchronous.rb', line 10 def all_batches_complete # NOP end |
#clone_next_batch(model_specs, complete_handler) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/clone_kit/strategies/synchronous.rb', line 14 def clone_next_batch(model_specs, complete_handler) model_specs.each do |spec| spec.cloner.clone_ids(spec.emitter.scope(operation.arguments).pluck(:id), operation) end complete_handler.new.complete( true, "operation" => { already_cloned: operation.already_cloned + model_specs.map(&:model).map(&:to_s), id: operation.id, arguments: operation.arguments, strategy: CloneKit::Strategies::Synchronous } ) end |