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
|
||||
total_score: 293
|
||||
total_score: 296
|
||||
|
|
|
@ -33,5 +33,20 @@ module Mutant
|
|||
RUBY_VERSION == '1.8.7'
|
||||
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
|
||||
|
|
|
@ -46,16 +46,11 @@ module Mutant
|
|||
# @api private
|
||||
#
|
||||
def initialize(options)
|
||||
@killer = options.fetch(:killer) do
|
||||
raise ArgumentError, 'Missing :killer in options'
|
||||
end
|
||||
|
||||
@pattern = options.fetch(:pattern) do
|
||||
raise ArgumentError, 'Missing :pattern in options'
|
||||
end
|
||||
|
||||
@killer = Helper.extract_option(options, :killer)
|
||||
@pattern = Helper.extract_option(options, :pattern)
|
||||
@reporter = options.fetch(:reporter, Reporter::Null)
|
||||
@errors = []
|
||||
|
||||
run
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue