Class: Inch::Evaluation::File
- Inherits:
-
Object
- Object
- Inch::Evaluation::File
- Defined in:
- lib/inch/evaluation/file.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#objects ⇒ Object
Returns the value of attribute objects.
Class Method Summary collapse
Instance Method Summary collapse
- #fullname ⇒ Object
-
#grade ⇒ Object
grade, priority, and score are not meant to be displayed in the CLI they are just for internal evaluation purposes.
-
#initialize(filename, objects) ⇒ File
constructor
A new instance of File.
- #priority ⇒ Object
- #score ⇒ Object
Constructor Details
#initialize(filename, objects) ⇒ File
Returns a new instance of File.
6 7 8 9 10 11 |
# File 'lib/inch/evaluation/file.rb', line 6 def initialize(filename, objects) self.filename = filename self.objects = objects.select do |o| o.filename == filename end end |
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
4 5 6 |
# File 'lib/inch/evaluation/file.rb', line 4 def filename @filename end |
#objects ⇒ Object
Returns the value of attribute objects.
4 5 6 |
# File 'lib/inch/evaluation/file.rb', line 4 def objects @objects end |
Class Method Details
.for(filename, objects) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/inch/evaluation/file.rb', line 51 def for(filename, objects) @cache ||= {} if file = @cache[filename] file else @cache[filename] = new(filename, objects) end end |
Instance Method Details
#fullname ⇒ Object
Note:
added to be compatible with code objects
14 15 16 |
# File 'lib/inch/evaluation/file.rb', line 14 def fullname filename end |
#grade ⇒ Object
grade, priority, and score are not meant to be displayed in the CLI they are just for internal evaluation purposes
23 24 25 |
# File 'lib/inch/evaluation/file.rb', line 23 def grade median(grades.sort_by(&:to_sym)) end |
#priority ⇒ Object
27 28 29 |
# File 'lib/inch/evaluation/file.rb', line 27 def priority median(priorities.sort) end |
#score ⇒ Object
31 32 33 |
# File 'lib/inch/evaluation/file.rb', line 31 def score objects.select(&:undocumented?).size end |