Class: Warped::Emails::Text
- Defined in:
- lib/warped/emails/components/text.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(text = nil, size: nil, color: nil, weight: nil, align: nil, display: nil) ⇒ Text
constructor
A new instance of Text.
- #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, size: nil, color: nil, weight: nil, align: nil, display: nil) ⇒ Text
Returns a new instance of Text.
42 43 44 45 46 47 48 49 50 |
# File 'lib/warped/emails/components/text.rb', line 42 def initialize(text = nil, size: nil, color: nil, weight: nil, align: nil, display: nil) super() @text = text @size = size @color = color @weight = weight @align = align @display = display end |
Instance Method Details
#template ⇒ Object
56 57 58 59 60 |
# File 'lib/warped/emails/components/text.rb', line 56 def template(&) style = style(size:, color:, weight:, align:, display:) tag.p(text, style:) end |
#text ⇒ Object
52 53 54 |
# File 'lib/warped/emails/components/text.rb', line 52 def text content.presence || @text end |