class HighWaterMark::Threshold
Calculate threshold for quality gem tool
Attributes
tool_name[R]
Public Class Methods
new(tool_name, count_file: File, count_io: IO, output_dir: 'metrics')
click to toggle source
# File lib/high_water_mark/threshold.rb, line 8 def initialize(tool_name, count_file: File, count_io: IO, output_dir: 'metrics') @tool_name = tool_name @count_file = count_file @count_io = count_io @filename = File.join(output_dir, "#{tool_name}_high_water_mark") end
Public Instance Methods
threshold()
click to toggle source
# File lib/high_water_mark/threshold.rb, line 18 def threshold return @count_io.read(@filename).to_i if @count_file.exist?(@filename) end
write_violations(new_violations)
click to toggle source
# File lib/high_water_mark/threshold.rb, line 22 def write_violations(new_violations) @count_file.open(@filename, 'w') do |file| file.write(new_violations.to_s + "\n") end end