Class: DigestEmail::DigestFooter

Inherits:
DigestElement show all
Defined in:
lib/digest_email/digest_footer.rb

Instance Attribute Summary collapse

Attributes inherited from DigestElement

#children

Instance Method Summary collapse

Constructor Details

#initialize(footer) ⇒ DigestFooter

Returns a new instance of DigestFooter.



8
9
10
11
12
# File 'lib/digest_email/digest_footer.rb', line 8

def initialize(footer)
  super()
  @signature = footer["signature"]
  @sponsors_image = footer["sponsors_image"]
end

Instance Attribute Details

#signatureObject

Returns the value of attribute signature.



6
7
8
# File 'lib/digest_email/digest_footer.rb', line 6

def signature
  @signature
end

#sponsors_imageObject

Returns the value of attribute sponsors_image.



6
7
8
# File 'lib/digest_email/digest_footer.rb', line 6

def sponsors_image
  @sponsors_image
end

Instance Method Details

#renderObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/digest_email/digest_footer.rb', line 14

def render
  parsed_signature = Maruku.new(@signature).to_html
  html  = [
    "<div class=\"digest-email-dot-seperator\"></div>",
    "<div class=\"digest-email-footer-signature\"><div>#{parsed_signature}</div></div>",
    render_sponsors_image
  ]

  wrap html.join("\n")
end

#render_sponsors_imageObject



25
26
27
28
29
30
# File 'lib/digest_email/digest_footer.rb', line 25

def render_sponsors_image
  html  = ["<div class=\"digest-email-footer-sponsors-image\">"]
  html << ["<img src=\"#{@sponsors_image}\"/>"]
  html << ["</div>"]
  html.join("\n")
end

#wrap(inner) ⇒ Object



32
33
34
# File 'lib/digest_email/digest_footer.rb', line 32

def wrap(inner)
  "<div class=\"digest-email-footer\">#{inner}</div>"
end