Sha256: 15acedc1bdb8fe1fa9d5a1e3fc2f91632c0125a394238f5842fc532e2ec0e523
Contents?: true
Size: 932 Bytes
Versions: 2
Compression:
Stored size: 932 Bytes
Contents
class BootstrapBuilders::Table def initialize(args) @args = args @blk = args.delete(:blk) @context = args.delete(:context) end def html @context.content_tag(:table, attributes, &@blk) end private def attributes attributes = {class: classes} pass_through = [:data] pass_through.each do |pass_through_arg| next unless @args.key?(pass_through_arg) attributes[pass_through_arg] = @args[pass_through_arg] end attributes end def classes if @args[:bs_classes] classes = @args[:bs_classes] else classes = BootstrapBuilders.configuration.default_table_classes end classes.map! { |class_name| "table-#{class_name}" } if @args[:class].is_a?(String) classes += @args.fetch(:class).split(/\s+/) elsif @args[:class].is_a?(Array) classes += @args.fetch(:class) end classes += ["table", "bb-table"] classes end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bootstrap_builders-0.0.5 | lib/bootstrap_builders/table.rb |
bootstrap_builders-0.0.4 | lib/bootstrap_builders/table.rb |