Class: Passcard::HtmlOutputter

Inherits:
Outputter show all
Defined in:
lib/passcard/outputter/html_outputter.rb

Constant Summary

Constants inherited from Outputter

Outputter::HEADERS

Instance Attribute Summary

Attributes inherited from Outputter

#grid, #palette, #reader

Instance Method Summary collapse

Methods inherited from Outputter

#col_headers, #data_in, #get_grid, #initialize, register, #row_headers, #use_palette

Constructor Details

This class inherits a constructor from Passcard::Outputter

Instance Method Details

#to_html(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/passcard/outputter/html_outputter.rb', line 5

def to_html(options = {})
  html = ""
  get_grid(options)
  use_palette options[:color]

  html += get_col_headers if options[:header]

  grid.row_size.times.map do |i|
    html += "<div class='row'>"
    html += get_row_header(i) if options[:header]
    html += get_row(i, options[:color])
    html += "</div>"
  end

  data = data_in(__FILE__).gsub('{{GRID}}', html)
  data = data.gsub('{{BACKGROUND}}', get_background) if options[:color]
  data
end