6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/active_model_archive/dump.rb', line 6
def dump!(filename, options = {})
query = options[:query]
per_file = options[:per_file] ? options[:per_file].to_i : nil
file_manager = FileManager.new(filename, per_file) do |file_manager|
if query.blank?
find_each do |object|
yield(object) if block_given?
file_manager.add(object)
end
else
search_each(query) do |object|
yield(object) if block_given?
file_manager.add(object)
end
end
end
file_manager.item_count
end
|