Adjust flay score
* Remove some duplication with an option extraction helper method.
This commit is contained in:
parent
7d8c1f02ff
commit
5b6e0a12d3
3 changed files with 19 additions and 9 deletions
|
@ -1,3 +1,3 @@
|
||||||
---
|
---
|
||||||
threshold: 18
|
threshold: 18
|
||||||
total_score: 293
|
total_score: 296
|
||||||
|
|
|
@ -33,5 +33,20 @@ module Mutant
|
||||||
RUBY_VERSION == '1.8.7'
|
RUBY_VERSION == '1.8.7'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Extract option from options hash
|
||||||
|
#
|
||||||
|
# @param [Hash] options
|
||||||
|
# @param [Object] key
|
||||||
|
#
|
||||||
|
# @return [Object] value
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
|
#
|
||||||
|
def self.extract_option(options, key)
|
||||||
|
options.fetch(key) do
|
||||||
|
raise ArgumentError,"Missing #{key.inspect} in options"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -46,16 +46,11 @@ module Mutant
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def initialize(options)
|
def initialize(options)
|
||||||
@killer = options.fetch(:killer) do
|
@killer = Helper.extract_option(options, :killer)
|
||||||
raise ArgumentError, 'Missing :killer in options'
|
@pattern = Helper.extract_option(options, :pattern)
|
||||||
end
|
|
||||||
|
|
||||||
@pattern = options.fetch(:pattern) do
|
|
||||||
raise ArgumentError, 'Missing :pattern in options'
|
|
||||||
end
|
|
||||||
|
|
||||||
@reporter = options.fetch(:reporter, Reporter::Null)
|
@reporter = options.fetch(:reporter, Reporter::Null)
|
||||||
@errors = []
|
@errors = []
|
||||||
|
|
||||||
run
|
run
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue