Class: Hashira::Report::FindingLines
- Inherits:
-
Object
- Object
- Hashira::Report::FindingLines
- Defined in:
- lib/hashira/report/finding_lines.rb
Constant Summary collapse
- SAMPLE =
4
Instance Method Summary collapse
-
#initialize(finding, indent: "", io: $stdout) ⇒ FindingLines
constructor
A new instance of FindingLines.
- #print ⇒ Object
- #print_with_overflow ⇒ Object
Constructor Details
#initialize(finding, indent: "", io: $stdout) ⇒ FindingLines
Returns a new instance of FindingLines.
8 9 10 11 12 |
# File 'lib/hashira/report/finding_lines.rb', line 8 def initialize(finding, indent: "", io: $stdout) @finding = finding @indent = indent @io = io end |
Instance Method Details
#print ⇒ Object
14 15 16 17 |
# File 'lib/hashira/report/finding_lines.rb', line 14 def print @io.puts "#{@indent}#{@finding.kind}: #{@finding.}" @finding.evidence.first(SAMPLE).each { @io.puts "#{@indent} · #{_1}" } end |
#print_with_overflow ⇒ Object
19 20 21 22 23 |
# File 'lib/hashira/report/finding_lines.rb', line 19 def print_with_overflow print overflow = @finding.evidence.size - SAMPLE @io.puts "#{@indent} · … (#{overflow} more)" if overflow.positive? end |