class CSV2HTML::Conversor
Attributes
headers[R]
options[R]
rows[R]
Public Class Methods
new(data, options)
click to toggle source
# File lib/csv2html.rb, line 13 def initialize(data, options) parser = CSV.parse(data, headers: true) @headers = parser.headers @options = options @rows = parser end
Public Instance Methods
get_binding()
click to toggle source
# File lib/csv2html.rb, line 20 def get_binding binding end
header_class(options, index)
click to toggle source
# File lib/csv2html.rb, line 40 def header_class(options, index) classes = options[:header_class] if classes.nil? || classes[index].nil? '' else " class=\"#{classes[index]}\"" end end
row_class(options, index)
click to toggle source
# File lib/csv2html.rb, line 31 def row_class(options, index) classes = options[:row_class] if classes.nil? || classes[index].nil? '' else " class=\"#{classes[index]}\"" end end
tag(name, opts={})
click to toggle source
# File lib/csv2html.rb, line 24 def tag(name, opts={}) output = [name] output << "class=\"#{opts[:class]}\"" if opts.has_key?(:class) output << "id=\"#{opts[:id]}\"" if opts.has_key?(:id) "<" + output.join(' ') + ">" end