Class: EasyTable::Components::Span

Inherits:
Object
  • Object
show all
Includes:
Base, Columns, Spans
Defined in:
lib/easy_table/components/span.rb

Instance Method Summary collapse

Methods included from Spans

#span

Methods included from Columns

#column

Methods included from Base

#translate

Constructor Details

#initialize(node, title, label, html_opts, template, block) ⇒ Span

Returns a new instance of Span.



8
9
10
11
12
13
14
15
16
# File 'lib/easy_table/components/span.rb', line 8

def initialize(node, title, label, html_opts, template, block)
  @node = node
  @title = title
  @label = label
  @template = template
  @block = block
  @html_opts = html_opts
  block.call(self)
end

Instance Method Details

#headObject



20
21
22
23
# File 'lib/easy_table/components/span.rb', line 20

def head
  opts = @html_opts.merge(colspan: colspan, scope: 'col')
  concat (:th, label, opts)
end

#td(record) ⇒ Object



25
26
27
28
29
# File 'lib/easy_table/components/span.rb', line 25

def td(record)
  columns.each do |col|
    col.td(record)
  end
end