Class: Minitest::Subjective::FileResult
- Inherits:
-
Object
- Object
- Minitest::Subjective::FileResult
- Defined in:
- lib/minitest/subjective/file_result.rb,
lib/minitest/subjective/file_result/range.rb,
lib/minitest/subjective/file_result/location.rb,
lib/minitest/subjective/file_result/line_statistics.rb,
lib/minitest/subjective/file_result/branch_statistics.rb,
lib/minitest/subjective/file_result/method_statistics.rb,
lib/minitest/subjective/file_result/line_statistics/line_hits.rb,
lib/minitest/subjective/file_result/line_statistics/formatting.rb,
lib/minitest/subjective/file_result/branch_statistics/formatting.rb,
lib/minitest/subjective/file_result/method_statistics/formatting.rb,
lib/minitest/subjective/file_result/branch_statistics/branch_hits.rb,
lib/minitest/subjective/file_result/method_statistics/method_hits.rb,
lib/minitest/subjective/file_result/branch_statistics/conditional_hits.rb
Overview
:nodoc:
Defined Under Namespace
Classes: BranchStatistics, LineStatistics, Location, MethodStatistics, Range
Instance Attribute Summary collapse
-
#line_statistics ⇒ Object
readonly
Returns the value of attribute line_statistics.
-
#method_statistics ⇒ Object
readonly
Returns the value of attribute method_statistics.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #+(other) ⇒ Object
- #-(other) ⇒ Object
- #==(other) ⇒ Object
- #blank? ⇒ Boolean
- #covered? ⇒ Boolean
-
#initialize(path, line_statistics:, method_statistics: nil) ⇒ FileResult
constructor
A new instance of FileResult.
- #to_s ⇒ Object
Constructor Details
#initialize(path, line_statistics:, method_statistics: nil) ⇒ FileResult
Returns a new instance of FileResult.
20 21 22 23 24 |
# File 'lib/minitest/subjective/file_result.rb', line 20 def initialize(path, line_statistics:, method_statistics: nil) @path = path @line_statistics = line_statistics @method_statistics = method_statistics end |
Instance Attribute Details
#line_statistics ⇒ Object (readonly)
Returns the value of attribute line_statistics.
11 12 13 |
# File 'lib/minitest/subjective/file_result.rb', line 11 def line_statistics @line_statistics end |
#method_statistics ⇒ Object (readonly)
Returns the value of attribute method_statistics.
11 12 13 |
# File 'lib/minitest/subjective/file_result.rb', line 11 def method_statistics @method_statistics end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
11 12 13 |
# File 'lib/minitest/subjective/file_result.rb', line 11 def path @path end |
Class Method Details
.from_result(path, modes) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/minitest/subjective/file_result.rb', line 13 def self.from_result(path, modes) BranchStatistics.from_hash(modes[:branches].to_h).then do |branches| new(path, line_statistics: LineStatistics.from_hash(modes[:lines].to_a, branches:), method_statistics: MethodStatistics.from_hash(modes[:methods].to_h, branches:)) end end |
Instance Method Details
#+(other) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/minitest/subjective/file_result.rb', line 26 def +(other) return self unless other self.class.new(@path, line_statistics: other ? line_statistics + other.line_statistics : line_statistics, method_statistics: other ? method_statistics + other.method_statistics : method_statistics) end |
#-(other) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/minitest/subjective/file_result.rb', line 34 def -(other) return self unless other self.class.new(@path, line_statistics: other ? line_statistics - other.line_statistics : line_statistics, method_statistics: other ? method_statistics - other.method_statistics : method_statistics) end |
#==(other) ⇒ Object
52 53 54 |
# File 'lib/minitest/subjective/file_result.rb', line 52 def ==(other) other && line_statistics == other.line_statistics && method_statistics == other.method_statistics end |
#blank? ⇒ Boolean
42 43 44 |
# File 'lib/minitest/subjective/file_result.rb', line 42 def blank? line_statistics.nil? end |
#covered? ⇒ Boolean
48 49 50 |
# File 'lib/minitest/subjective/file_result.rb', line 48 def covered? line_statistics.covered? && method_statistics.covered? end |