Class: Warped::Emails::Heading

Inherits:
Base
  • Object
show all
Defined in:
lib/warped/emails/components/heading.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

Constructor Details

#initialize(text = nil, level: nil, align: nil, color: nil, weight: nil) ⇒ Heading

Returns a new instance of Heading.



41
42
43
44
45
46
47
48
# File 'lib/warped/emails/components/heading.rb', line 41

def initialize(text = nil, level: nil, align: nil, color: nil, weight: nil)
  super()
  @text = text
  @level = level
  @align = align
  @color = color
  @weight = weight
end

Instance Method Details

#templateObject



54
55
56
57
58
# File 'lib/warped/emails/components/heading.rb', line 54

def template
  style = style(level:, align:, color:, weight:)

  tag.send(level, text, style:)
end

#textObject



50
51
52
# File 'lib/warped/emails/components/heading.rb', line 50

def text
  content.presence || @text
end