Module: EasyTable::Components::Columns

Included in:
Span, TableBuilder
Defined in:
lib/easy_table/components/columns.rb

Instance Method Summary collapse

Instance Method Details

#column(title, label_or_opts = nil, opts = {}, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/easy_table/components/columns.rb', line 4

def column(title, label_or_opts = nil, opts = {}, &block)
  if label_or_opts.is_a?(Hash) && label_or_opts.extractable_options?
    label = nil
    opts = label_or_opts
  else
    label = label_or_opts
    opts = opts
  end
  child = node << Tree::TreeNode.new(title)
  column = Column.new(child, title, label, opts, @template, block)
  child.content = column
end