Sha256: 9b4a0f872ca7ee5fa7be108d88ce1e1d5e4e4e51032f296a79143c5b641e420b
Contents?: true
Size: 1.23 KB
Versions: 4
Compression:
Stored size: 1.23 KB
Contents
module Inch module Evaluation class File attr_accessor :filename, :objects def initialize(filename, objects) self.filename = filename self.objects = objects.select do |o| o.filename == filename end end # @note added to be compatible with code objects def path filename end # # grade, priority, and score are not meant to be displayed in the CLI # they are just for internal evaluation purposes # def grade median(grades.sort) end def priority median(priorities.sort) end def score objects.select(&:undocumented?).size end private def grades objects.map(&:grade) end def priorities objects.map(&:priority) end def scores objects.map(&:score) end def median(sorted_list) index = (sorted_list.size / 2).round sorted_list[index] end class << self def for(filename, objects) @cache ||= {} if file = @cache[filename] file else @cache[filename] = new(filename, objects) end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
inch-0.1.3 | lib/inch/evaluation/file.rb |
inch-0.1.2 | lib/inch/evaluation/file.rb |
inch-0.1.1 | lib/inch/evaluation/file.rb |
inch-0.1.0 | lib/inch/evaluation/file.rb |