Class: FixtureKit::Analyzer::FileResult
- Inherits:
-
Object
- Object
- FixtureKit::Analyzer::FileResult
- Defined in:
- lib/fixture_kit/analyzer/file_result.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#lets ⇒ Object
readonly
Returns the value of attribute lets.
-
#total_examples ⇒ Object
readonly
Returns the value of attribute total_examples.
Instance Method Summary collapse
-
#initialize(file:, total_examples:, lets:) ⇒ FileResult
constructor
A new instance of FileResult.
- #max_reuse ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(file:, total_examples:, lets:) ⇒ FileResult
Returns a new instance of FileResult.
8 9 10 11 12 |
# File 'lib/fixture_kit/analyzer/file_result.rb', line 8 def initialize(file:, total_examples:, lets:) @file = file @total_examples = total_examples @lets = lets.sort_by { |l| -l.example_count } end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
6 7 8 |
# File 'lib/fixture_kit/analyzer/file_result.rb', line 6 def file @file end |
#lets ⇒ Object (readonly)
Returns the value of attribute lets.
6 7 8 |
# File 'lib/fixture_kit/analyzer/file_result.rb', line 6 def lets @lets end |
#total_examples ⇒ Object (readonly)
Returns the value of attribute total_examples.
6 7 8 |
# File 'lib/fixture_kit/analyzer/file_result.rb', line 6 def total_examples @total_examples end |
Instance Method Details
#max_reuse ⇒ Object
14 15 16 |
# File 'lib/fixture_kit/analyzer/file_result.rb', line 14 def max_reuse lets.first&.example_count || 0 end |
#to_h ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/fixture_kit/analyzer/file_result.rb', line 18 def to_h { file: file, total_examples: total_examples, max_reuse: max_reuse, lets: lets.map(&:to_h), } end |