lib/undercover/result.rb in undercover-0.6.2 vs lib/undercover/result.rb in undercover-0.6.3
- old
+ new
@@ -8,13 +8,19 @@
attr_reader :node, :coverage, :file_path
def_delegators :node, :first_line, :last_line, :name
- def initialize(node, file_cov, file_path)
+ def initialize(node, file_cov, file_path) # rubocop:disable Metrics/MethodLength
@node = node
@coverage = file_cov.select do |ln, _|
- (node.empty_def? ? ln >= first_line : ln > first_line) && ln < last_line
+ if first_line == last_line
+ ln == first_line
+ elsif node.empty_def?
+ ln >= first_line
+ else
+ ln > first_line && ln < last_line
+ end
end
@file_path = file_path
@flagged = false
end