Class: Codnar::Merger
- Inherits:
-
Object
- Object
- Codnar::Merger
- Defined in:
- lib/codnar/merger.rb
Overview
Merge classified lines into chunks.
Class Method Summary collapse
-
.chunks(errors, path, lines) ⇒ Object
Convert classified lines from a disk file into chunks.
Instance Method Summary collapse
-
#chunks ⇒ Object
Return merged chunks containing the classified lines.
Class Method Details
.chunks(errors, path, lines) ⇒ Object
Convert classified lines from a disk file into chunks.
7 8 9 |
# File 'lib/codnar/merger.rb', line 7 def self.chunks(errors, path, lines) return Merger.new(errors, path, lines).chunks end |
Instance Method Details
#chunks ⇒ Object
Return merged chunks containing the classified lines. Each chunk lines are only indented relative to the chunk. This allows nested chunks to be presented unindented in the final weaved HTML.
14 15 16 17 18 19 20 |
# File 'lib/codnar/merger.rb', line 14 def chunks @chunks = [ file_chunk ] @stack = @chunks.dup @errors.in_path(@path) { merge_lines } @chunks.each { |chunk| Merger.unindent_lines(chunk.lines) } return @chunks end |