class ExpressMailer::Attributes

Attributes

button[RW]
configuration[RW]
from[RW]
header[RW]
headline[RW]
image[RW]
preheader[RW]
reply_to[RW]
style[RW]
subject[RW]
table[RW]
text[RW]
to[RW]

Public Class Methods

new(options = {}) click to toggle source
# File lib/express_mailer/attributes.rb, line 14
def initialize(options = {})
  @configuration = ExpressMailer.configuration
  @style = options.fetch(:style, :info)
  @to = options.fetch(:to, @configuration.default_to)
  @from = options.fetch(:from, @configuration.default_from)
  @reply_to = options.fetch(:reply_to, nil)
  @subject = options.fetch(:subject, "Express Mail")
  @preheader = options.fetch(:preheader, Date.today.strftime('%B %-d, %Y'))
  @header = options.fetch(:header, @subject)
  @footer = options.fetch(:footer, @configuration.default_footer)
  @headline = options.fetch(:headline, nil)
  @image = ExpressMailer::Image.create(options.fetch(:image, nil))
  @table = ExpressMailer::Table.create(options.fetch(:table, nil))
  @button = ExpressMailer::Button.create(options.fetch(:button, nil))
  @text = options.fetch(:text, nil)
end

Public Instance Methods

button_background_color() click to toggle source
# File lib/express_mailer/attributes.rb, line 43
def button_background_color
  @configuration.instance_variable_get(:"@#{@style}_button_background_color")
end
button_text_color() click to toggle source
# File lib/express_mailer/attributes.rb, line 39
def button_text_color
  @configuration.instance_variable_get(:"@#{@style}_button_text_color")
end
headline_text_color() click to toggle source
# File lib/express_mailer/attributes.rb, line 35
def headline_text_color
  @configuration.instance_variable_get(:"@#{@style}_text_color")
end
text_align() click to toggle source
# File lib/express_mailer/attributes.rb, line 47
def text_align
  if @text.to_s.length > 240
    :left
  else
    :center
  end
end
text_size() click to toggle source
# File lib/express_mailer/attributes.rb, line 55
def text_size
  if @text.to_s.length > 60
    20
  else
    26
  end
end