Class: Diffed::Section

Inherits:
Object
  • Object
show all
Includes:
DiffHtml
Defined in:
lib/models/section.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DiffHtml

#as_html_table

Constructor Details

#initialize(header, lines) ⇒ Section

Returns a new instance of Section.



8
9
10
# File 'lib/models/section.rb', line 8

def initialize(header, lines)
  @header, @lines = header, lines
end

Instance Attribute Details

#headerObject (readonly)

Returns the value of attribute header.



6
7
8
# File 'lib/models/section.rb', line 6

def header
  @header
end

#linesObject (readonly)

Returns the value of attribute lines.



6
7
8
# File 'lib/models/section.rb', line 6

def lines
  @lines
end

Instance Method Details

#as_html_rows(use_inline_styles, row_nums_to_highlight = []) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/models/section.rb', line 12

def as_html_rows(use_inline_styles, row_nums_to_highlight = [])
  html = format_section_header_row(use_inline_styles)
  lines.each_with_index do |line, i| 
    html << line.as_html_row(use_inline_styles, row_nums_to_highlight.include?(i + 1))
  end
  
  html
end