Class: SimplecovCovview::CovView::Srcfile::Line
- Inherits:
-
Object
- Object
- SimplecovCovview::CovView::Srcfile::Line
- Defined in:
- lib/simplecov_covview/line.rb
Instance Method Summary collapse
- #colorize_contents ⇒ Object
- #contents ⇒ Object
- #cov_count ⇒ Object
- #cov_width ⇒ Object
-
#initialize(line, src_file) ⇒ Line
constructor
Create text for each line from @src_files_list.
- #line_number ⇒ Object
- #line_width ⇒ Object
- #source_code ⇒ Object
- #status ⇒ Object
Constructor Details
#initialize(line, src_file) ⇒ Line
Create text for each line from @src_files_list.
9 10 11 12 |
# File 'lib/simplecov_covview/line.rb', line 9 def initialize(line, src_file) @line = line @src_file = src_file end |
Instance Method Details
#colorize_contents ⇒ Object
47 48 49 50 |
# File 'lib/simplecov_covview/line.rb', line 47 def colorize_contents row = SimplecovCovview::CovView::Srcfile::Color.new(status, contents) row.colorize end |
#contents ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/simplecov_covview/line.rb', line 38 def contents [ sprintf("%#{line_width}s: ", line_number), sprintf("[%7s] ", status), sprintf("[%#{cov_width}s ] ", cov_count), source_code.chomp("\r\n"), ].join end |
#cov_count ⇒ Object
26 27 28 |
# File 'lib/simplecov_covview/line.rb', line 26 def cov_count @line[:cov] end |
#cov_width ⇒ Object
30 31 32 |
# File 'lib/simplecov_covview/line.rb', line 30 def cov_width @src_file[:cov_digit] < 4 ? 4 : @src_file[:cov_digit] + 1 end |
#line_number ⇒ Object
14 15 16 |
# File 'lib/simplecov_covview/line.rb', line 14 def line_number @line[:num] end |
#line_width ⇒ Object
18 19 20 |
# File 'lib/simplecov_covview/line.rb', line 18 def line_width @src_file[:line_digit] < 4 ? 4 : @src_file[:line_digit] end |
#source_code ⇒ Object
34 35 36 |
# File 'lib/simplecov_covview/line.rb', line 34 def source_code @line[:src] end |
#status ⇒ Object
22 23 24 |
# File 'lib/simplecov_covview/line.rb', line 22 def status @line[:status] end |