Class: Warped::Emails::Link

Inherits:
Text show all
Defined in:
lib/warped/emails/components/link.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, 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

#templateObject



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

#textObject



21
22
23
# File 'lib/warped/emails/components/link.rb', line 21

def text
  content.presence || @text
end