Class: Warped::Emails::Table

Inherits:
Base
  • Object
show all
Defined in:
lib/warped/emails/components/table.rb

Instance Attribute Summary

Attributes inherited from Base

#view_context

Instance Method Summary collapse

Methods inherited from Base

#content, #helpers, #render_in

Methods included from Styleable

#base_styles, #default_variants, included, #style, #variants

Methods included from Slottable

included, #slots

Instance Method Details

#templateObject

Raises:

  • (ArgumentError)


23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/warped/emails/components/table.rb', line 23

def template
  raise ArgumentError, "at least one row must be passed to the table" if rows.empty?

  (:table, style:) do
    concat (:thead, header, style: style(:header))
    concat (:tbody) do
      rows.each do |row|
        concat (:tr, row, style: style(:row))
      end
    end
  end
end