lib/outliers/evaluation.rb in outliers-0.1.1 vs lib/outliers/evaluation.rb in outliers-0.2.0

- old
+ new

@@ -24,27 +24,35 @@ @collection = collection_object name targets_array = Array(targets) if targets_array.any? - logger.info "Verifying against '#{targets_array.join(', ')}' from '#{name}' collection." + logger.info "Verifying '#{targets_array.join(', ')}' from '#{name}' collection." collection.targets = targets_array end collection end def exclude(exclusions) collection.exclude_by_key Array(exclusions) end + def filter(args) + collection.filter args.keys_to_s + end + def verify(verification, arguments={}) - collection.load_all + @resources_loaded ||= collection.load_all - r = collection.verify verification, arguments.keys_to_sym + verification_result = collection.verify verification, arguments.keys_to_sym - result = Outliers::Result.new :description => @name, :passed => r + result = Outliers::Result.new evaluation: @name, + failing_resources: verification_result.fetch(:failing_resources), + passing_resources: verification_result.fetch(:passing_resources), + resource: @collection, + verification: verification - logger.info "Evaluation '#{result}'." + logger.info "Verification '#{verification}' #{result}." @run.results << result end private