DanaDanger-data_transport 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
data/lib/data_transport.rb
CHANGED
@@ -35,13 +35,13 @@ module DataTransport
|
|
35
35
|
raise(TypeError, "batch size must be an integer") unless batch_size.is_a?(Integer)
|
36
36
|
raise(RangeError, "batch size must be greater than zero") if batch_size < 1
|
37
37
|
unless options.empty?
|
38
|
-
raise(ArgumentError, "unrecognized options: `#{options.join("', `")}'")
|
38
|
+
raise(ArgumentError, "unrecognized options: `#{options.keys.join("', `")}'")
|
39
39
|
end
|
40
40
|
# Run the transport.
|
41
41
|
output.reset
|
42
42
|
source = DataTransport::Record::Source.new
|
43
43
|
destination = DataTransport::Record::Destination.new
|
44
|
-
input.each_record do |record|
|
44
|
+
input.each_record(batch_size) do |record|
|
45
45
|
source.record = record
|
46
46
|
destination.reset!
|
47
47
|
yield source, destination
|
@@ -121,7 +121,7 @@ module DataTransport
|
|
121
121
|
@class.count(:conditions => @conditions)
|
122
122
|
end
|
123
123
|
|
124
|
-
def each_record(batch_size) # :nodoc:
|
124
|
+
def each_record(batch_size = nil) # :nodoc:
|
125
125
|
conn = @class.connection
|
126
126
|
column_names = conn.columns(@class.table_name).collect {|c| c.name}
|
127
127
|
|