Class: Bootstrap5RailsExtensions::TableHelper::TableBuilder

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/bootstrap5_rails_extensions/table_helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(view_context) ⇒ TableBuilder

Returns a new instance of TableBuilder.



60
61
62
63
# File 'app/helpers/bootstrap5_rails_extensions/table_helper.rb', line 60

def initialize(view_context)
  @view = view_context
  @sections = []
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'app/helpers/bootstrap5_rails_extensions/table_helper.rb', line 79

def empty?
  @sections.empty?
end

#renderObject



75
76
77
# File 'app/helpers/bootstrap5_rails_extensions/table_helper.rb', line 75

def render
  @view.safe_join(@sections)
end

#tbody(**options, &block) ⇒ Object



70
71
72
73
# File 'app/helpers/bootstrap5_rails_extensions/table_helper.rb', line 70

def tbody(**options, &block)
  append_section(:tbody, options, block)
  self
end

#thead(**options, &block) ⇒ Object



65
66
67
68
# File 'app/helpers/bootstrap5_rails_extensions/table_helper.rb', line 65

def thead(**options, &block)
  append_section(:thead, options, block)
  self
end