Method: Listalicious::TableBuilder#column

Defined in:
lib/builders/table_builder.rb

#column(*args, &proc) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/builders/table_builder.rb', line 76

def column(*args, &proc)
  options = args.extract_options!
  contents = options == args.first ? nil : args.first

  if @current_scope == :body
    contents = if block_given?
      template.capture(self, &proc)
    elsif args.last.is_a?(Proc)
      args.last.call
    else
      contents
    end
  else
    contents = options[:title] || contents
  end

  @column_count = @column_count + 1
  self.send("#{@current_scope}_column", contents, options)
end