lib/mass_insert/process.rb in mass_insert-0.1.2 vs lib/mass_insert/process.rb in mass_insert-0.1.3
- old
+ new
@@ -6,19 +6,28 @@
def initialize values, options
@values = values
@options = options
end
- # Calls the necessary methods to complete the mass insertion process
- # and the time that each method takes being executed.
def start
+ # MassInsert process is completed by two actions. The first one
+ # gets queries that will be persisted.
@building_time = Benchmark.measure do
- @queries = Builder::Base.new.build(@values, @options)
+ @queries = builder.build(@values, @options)
end
+ # The second one executes queries into the database using an
+ # ActiveRecord connection.
@execution_time = Benchmark.measure do
- Executer.new.execute(@queries)
+ executer.execute(@queries)
end
end
+ def builder
+ @builder ||= Builder::Base.new
+ end
+
+ def executer
+ @executer ||= Executer.new
+ end
end
end