class Kitchen::Directions::BakeTableBody::V1::CustomBody

Attributes

fake_title[R]
fake_title_class[R]
klass[R]
table[R]
to_trash[R]

Public Class Methods

new(table:, klass:, fake_title_class: nil, fake_title: nil, to_trash: nil) click to toggle source
# File lib/kitchen/directions/bake_numbered_table/bake_table_body.rb, line 17
def initialize(table:, klass:, fake_title_class: nil, fake_title: nil, to_trash: nil)
  @table = table
  @klass = klass
  @fake_title_class = fake_title_class
  @fake_title = fake_title
  @to_trash = to_trash
end

Public Instance Methods

modify_body(has_fake_title: false) click to toggle source
# File lib/kitchen/directions/bake_numbered_table/bake_table_body.rb, line 25
          def modify_body(has_fake_title: false)
            @table.parent.add_class("os-#{@klass}-container")

            return unless has_fake_title

            @table.prepend(sibling:
              <<~HTML
                <div class="#{@fake_title_class}">#{@fake_title}</div>
              HTML
            )
            @to_trash.trash
          end