Class: Warped::Emails::Link
- Defined in:
- lib/warped/emails/components/link.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(text = nil, href, size: nil, color: nil, display: nil) ⇒ Link
constructor
A new instance of Link.
- #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, href, size: nil, color: nil, display: nil) ⇒ Link
Returns a new instance of Link.
12 13 14 15 16 17 18 19 |
# File 'lib/warped/emails/components/link.rb', line 12 def initialize(text = nil, href, size: nil, color: nil, display: nil) super() @text = text @href = href @size = size @color = color @display = display end |
Instance Method Details
#template ⇒ Object
25 26 27 28 29 |
# File 'lib/warped/emails/components/link.rb', line 25 def template style = style(size:, color:, display:) tag.a(text, href:, style:) end |
#text ⇒ Object
21 22 23 |
# File 'lib/warped/emails/components/link.rb', line 21 def text content.presence || @text end |