Class: Tabloid::HeaderRow

Inherits:
Object
  • Object
show all
Defined in:
lib/tabloid/header_row.rb

Instance Method Summary collapse

Constructor Details

#initialize(text, options = {}) ⇒ HeaderRow

Returns a new instance of HeaderRow.



2
3
4
5
# File 'lib/tabloid/header_row.rb', line 2

def initialize(text, options={})
  @text = text
  @options = options
end

Instance Method Details

#summarizeObject



22
23
24
# File 'lib/tabloid/header_row.rb', line 22

def summarize
  nil
end

#to_aObject



18
19
20
# File 'lib/tabloid/header_row.rb', line 18

def to_a
  [@text].fill(nil, 1, column_count-1)
end

#to_csvObject



7
8
9
# File 'lib/tabloid/header_row.rb', line 7

def to_csv
  FasterCSV.generate{|csv| csv << to_a}
end

#to_html(options = {}) ⇒ Object



11
12
13
14
15
16
# File 'lib/tabloid/header_row.rb', line 11

def to_html(options={})
  html = Builder::XmlMarkup.new
  html.tr("class" => (options[:class] || "header")) do |tr|
    tr.td(@text, "colspan" => column_count)
  end
end