Class: Warped::Emails::Heading
- Defined in:
- lib/warped/emails/components/heading.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(text = nil, level: nil, align: nil, color: nil, weight: nil) ⇒ Heading
constructor
A new instance of Heading.
- #template ⇒ Object
- #text ⇒ Object
Methods inherited from Base
#content, #helpers, #render_in
Methods included from Styleable
#base_styles, #default_variants, included, #style, #variants
Methods included from Slottable
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
#template ⇒ Object
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 |
#text ⇒ Object
50 51 52 |
# File 'lib/warped/emails/components/heading.rb', line 50 def text content.presence || @text end |