lib/outliers/run.rb in outliers-0.0.1 vs lib/outliers/run.rb in outliers-0.1.0
- old
+ new
@@ -6,21 +6,20 @@
@results = []
end
def process_evaluations_in_config_folder
evaluations_path = File.join Outliers.config_path
- entries = Dir.entries(evaluations_path) - ['.', '..']
- entries.each do |e|
- file = File.join(evaluations_path, e)
- unless File.directory? file
- logger.info "Processing '#{file}'."
- self.instance_eval File.read(file)
- end
+ files = Dir.glob(File.join(evaluations_path, '**', '*'))
+ files.each do |file|
+ next if File.directory? file
+ next if File.extname(file) != '.rb'
+ logger.info "Processing '#{file}'."
+ self.instance_eval File.read(file)
end
end
- def evaluate(name='unspecified')
- yield Evaluation.new :name => name, :run => self
+ def evaluate(name='unspecified', &block)
+ Evaluation.new(:name => name, :run => self).instance_eval &block
end
def passed
@results.select {|r| r.passed?}
end