Class: ExpressMailer::Attributes
- Inherits:
-
Object
- Object
- ExpressMailer::Attributes
- Defined in:
- lib/express_mailer/attributes.rb
Instance Attribute Summary collapse
-
#button ⇒ Object
Returns the value of attribute button.
-
#configuration ⇒ Object
Returns the value of attribute configuration.
-
#footer ⇒ Object
Returns the value of attribute footer.
-
#from ⇒ Object
Returns the value of attribute from.
-
#header ⇒ Object
Returns the value of attribute header.
-
#headline ⇒ Object
Returns the value of attribute headline.
-
#image ⇒ Object
Returns the value of attribute image.
-
#preheader ⇒ Object
Returns the value of attribute preheader.
-
#reply_to ⇒ Object
Returns the value of attribute reply_to.
-
#style ⇒ Object
Returns the value of attribute style.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#table ⇒ Object
Returns the value of attribute table.
-
#text ⇒ Object
Returns the value of attribute text.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #button_background_color ⇒ Object
- #button_text_color ⇒ Object
- #headline_text_color ⇒ Object
-
#initialize(options = {}) ⇒ Attributes
constructor
A new instance of Attributes.
- #text_align ⇒ Object
- #text_size ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Attributes
Returns a new instance of Attributes.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/express_mailer/attributes.rb', line 14 def initialize( = {}) @configuration = ExpressMailer.configuration @style = .fetch(:style, :info) @to = .fetch(:to, @configuration.default_to) @from = .fetch(:from, @configuration.default_from) @reply_to = .fetch(:reply_to, nil) @subject = .fetch(:subject, "Express Mail") @preheader = .fetch(:preheader, Date.today.strftime('%B %-d, %Y')) @header = .fetch(:header, @subject) @footer = .fetch(:footer, @configuration.) @headline = .fetch(:headline, nil) @image = ExpressMailer::Image.create(.fetch(:image, nil)) @table = ExpressMailer::Table.create(.fetch(:table, nil)) @button = ExpressMailer::Button.create(.fetch(:button, nil)) @text = .fetch(:text, nil) end |
Instance Attribute Details
#button ⇒ Object
Returns the value of attribute button.
7 8 9 |
# File 'lib/express_mailer/attributes.rb', line 7 def @button end |
#configuration ⇒ Object
Returns the value of attribute configuration.
7 8 9 |
# File 'lib/express_mailer/attributes.rb', line 7 def configuration @configuration end |
#footer ⇒ Object
Returns the value of attribute footer.
7 8 9 |
# File 'lib/express_mailer/attributes.rb', line 7 def @footer end |
#from ⇒ Object
Returns the value of attribute from.
7 8 9 |
# File 'lib/express_mailer/attributes.rb', line 7 def from @from end |
#header ⇒ Object
Returns the value of attribute header.
7 8 9 |
# File 'lib/express_mailer/attributes.rb', line 7 def header @header end |
#headline ⇒ Object
Returns the value of attribute headline.
7 8 9 |
# File 'lib/express_mailer/attributes.rb', line 7 def headline @headline end |
#image ⇒ Object
Returns the value of attribute image.
7 8 9 |
# File 'lib/express_mailer/attributes.rb', line 7 def image @image end |
#preheader ⇒ Object
Returns the value of attribute preheader.
7 8 9 |
# File 'lib/express_mailer/attributes.rb', line 7 def preheader @preheader end |
#reply_to ⇒ Object
Returns the value of attribute reply_to.
7 8 9 |
# File 'lib/express_mailer/attributes.rb', line 7 def reply_to @reply_to end |
#style ⇒ Object
Returns the value of attribute style.
7 8 9 |
# File 'lib/express_mailer/attributes.rb', line 7 def style @style end |
#subject ⇒ Object
Returns the value of attribute subject.
7 8 9 |
# File 'lib/express_mailer/attributes.rb', line 7 def subject @subject end |
#table ⇒ Object
Returns the value of attribute table.
7 8 9 |
# File 'lib/express_mailer/attributes.rb', line 7 def table @table end |
#text ⇒ Object
Returns the value of attribute text.
7 8 9 |
# File 'lib/express_mailer/attributes.rb', line 7 def text @text end |
#to ⇒ Object
Returns the value of attribute to.
7 8 9 |
# File 'lib/express_mailer/attributes.rb', line 7 def to @to end |
Instance Method Details
#button_background_color ⇒ Object
43 44 45 |
# File 'lib/express_mailer/attributes.rb', line 43 def @configuration.instance_variable_get(:"@#{@style}_button_background_color") end |
#button_text_color ⇒ Object
39 40 41 |
# File 'lib/express_mailer/attributes.rb', line 39 def @configuration.instance_variable_get(:"@#{@style}_button_text_color") end |
#headline_text_color ⇒ Object
35 36 37 |
# File 'lib/express_mailer/attributes.rb', line 35 def headline_text_color @configuration.instance_variable_get(:"@#{@style}_text_color") end |
#text_align ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/express_mailer/attributes.rb', line 47 def text_align if @text.to_s.length > 240 :left else :center end end |
#text_size ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/express_mailer/attributes.rb', line 55 def text_size if @text.to_s.length > 60 20 else 26 end end |