Class: BenchmarkFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/audit/lib/benchmark/benchmark_factory.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ BenchmarkFactory

Returns a new instance of BenchmarkFactory.



4
5
6
7
8
9
10
# File 'lib/audit/lib/benchmark/benchmark_factory.rb', line 4

def initialize(options)
	if options[:logger] then
		@logger = options[:logger]
	else
		@logger = Logger.new(STDOUT)
	end
end

Instance Method Details

#load(options) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/audit/lib/benchmark/benchmark_factory.rb', line 12

def load(options)
	raise "Need option :benchmark" unless options[:benchmark]
	
	if options[:benchmark] =~ /\.xml$/ then
		return XccdfBenchmark.new({:benchmark => options[:benchmark], :logger => @logger})
	elsif options[:benchmark] =~ /\.zip$/ then
		return YamlBenchmark.new({:benchmark => options[:benchmark], :logger => @logger})
	else
		raise "Unknown benchmark type"
	end
end