Class: Lecter::HtmlGenerator
- Inherits:
-
Object
- Object
- Lecter::HtmlGenerator
- Defined in:
- lib/lecter/html_generator.rb
Constant Summary collapse
- COUNT_LINES_AROUND_RUNNING_ROW =
5
- ELLIPSIS =
'...'
- NEW_LINE =
"\n"
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(data) ⇒ HtmlGenerator
constructor
A new instance of HtmlGenerator.
Constructor Details
#initialize(data) ⇒ HtmlGenerator
Returns a new instance of HtmlGenerator.
9 10 11 |
# File 'lib/lecter/html_generator.rb', line 9 def initialize(data) @data = data end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/lecter/html_generator.rb', line 13 def call @data.each.map do |item| @file_path = item.keys.first @executable_row_numbers = item.values.flatten previous_row_is_empty = false html_rows = file_context.each_with_index.map do |file_row, file_row_index| @file_row_index = file_row_index row_executable = executable_row_numbers.include?(file_row_index + 1) if row_executable || file_row_in_showing_range?(file_row_index) previous_row_is_empty = false Lecter::HtmlRow.new( file_row, file_row_index + 1, row_executable, executable_row_numbers ).create elsif !previous_row_is_empty previous_row_is_empty = true ELLIPSIS + NEW_LINE end end FileListing.new(file_path, html_rows) end end |