Class: BootstrapBuilders::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/bootstrap_builders/table.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Table

Returns a new instance of Table.



2
3
4
5
6
# File 'lib/bootstrap_builders/table.rb', line 2

def initialize(args)
  @args = args
  @blk = args.fetch(:blk)
  @context = args.fetch(:context)
end

Instance Method Details

#htmlObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/bootstrap_builders/table.rb', line 8

def html
  if @blk
    buffer = @context.(:table, attributes, &@blk)
  else
    buffer = @context.(:table, @content, attributes)
  end

  return buffer unless @args[:responsive]

  @context.(:div, buffer, class: "table-responsive")
end