Class: Rad::Mailer::Letter
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#from ⇒ Object
Returns the value of attribute from.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #deliver ⇒ Object
-
#initialize(properties) ⇒ Letter
constructor
A new instance of Letter.
- #to_hash ⇒ Object (also: #to_h)
- #validate! ⇒ Object
Constructor Details
#initialize(properties) ⇒ Letter
Returns a new instance of Letter.
6 7 8 9 10 |
# File 'lib/rad/mailer/_letter.rb', line 6 def initialize properties properties.each do |k, v| send "#{k}=", v end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/rad/mailer/_letter.rb', line 4 def body @body end |
#from ⇒ Object
Returns the value of attribute from.
4 5 6 |
# File 'lib/rad/mailer/_letter.rb', line 4 def from @from end |
#subject ⇒ Object
Returns the value of attribute subject.
4 5 6 |
# File 'lib/rad/mailer/_letter.rb', line 4 def subject @subject end |
#to ⇒ Object
Returns the value of attribute to.
4 5 6 |
# File 'lib/rad/mailer/_letter.rb', line 4 def to @to end |
Instance Method Details
#deliver ⇒ Object
19 20 21 22 |
# File 'lib/rad/mailer/_letter.rb', line 19 def deliver validate! mailer.deliver self end |
#to_hash ⇒ Object Also known as: to_h
24 25 26 |
# File 'lib/rad/mailer/_letter.rb', line 24 def to_hash {from: from, to: to, subject: subject, body: body} end |
#validate! ⇒ Object
12 13 14 15 16 17 |
# File 'lib/rad/mailer/_letter.rb', line 12 def validate! from || raise("letter :from not specified!") to || raise("letter :to not specified!") subject || raise("letter :subject not specified!") body || raise("letter :body not specified!") end |