lib/docparser/parser.rb in docparser-0.1.6 vs lib/docparser/parser.rb in docparser-0.2.0
- old
+ new
@@ -1,16 +1,14 @@
require 'rubygems'
require 'bundler/setup'
-require 'open-uri'
require 'parallel'
require 'set'
require 'log4r'
require 'log4r/formatter/patternformatter'
require 'docparser/version'
require 'docparser/output'
require 'docparser/document'
-require 'docparser/output/screen_output.rb'
require 'docparser/output/csv_output.rb'
require 'docparser/output/html_output.rb'
require 'docparser/output/xlsx_output.rb'
require 'docparser/output/yaml_output.rb'
require 'docparser/output/json_output.rb'
@@ -84,20 +82,20 @@
if output.is_a? Output
@outputs << output
elsif output.is_a?(Array) && output.all? { |o| o.is_a? Output }
@outputs = output
elsif !output.nil?
- raise ArgumentError, 'Invalid outputs specified'
+ fail ArgumentError, 'Invalid outputs specified'
end
@resultsets = Array.new(@outputs.length) { Set.new }
end
def parallel_process(&block)
@logger.info "Starting #{@num_processes} processes"
option = RUBY_ENGINE == 'ruby' ? :in_processes : :in_threads
- Parallel.map(@files, { option => @num_processes }) do |file|
+ Parallel.map(@files, option => @num_processes) do |file|
# :nocov: #
parse_doc(file, &block)
# :nocov: #
end.each do |result|
result.each_with_index do |set, index|
@@ -127,8 +125,7 @@
end
@resultsets[index] = nil
output.close
end
end
-
end
end