Module: Ditty::Services::Email
- Extended by:
- ActiveSupport::Inflector
- Defined in:
- lib/ditty/services/email.rb
Class Attribute Summary collapse
-
.config ⇒ Object
writeonly
Sets the attribute config.
Class Method Summary collapse
Class Attribute Details
.config=(value) ⇒ Object
Sets the attribute config
14 15 16 |
# File 'lib/ditty/services/email.rb', line 14 def config=(value) @config = value end |
Class Method Details
.config! ⇒ Object
16 17 18 19 20 21 |
# File 'lib/ditty/services/email.rb', line 16 def config! cfg = config Mail.defaults do delivery_method cfg[:delivery_method].to_sym, (cfg[:options] || {}) end end |
.deliver(email, to = nil, options = {}) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/ditty/services/email.rb', line 23 def deliver(email, to = nil, = {}) config! [:to] ||= to unless to.nil? [:from] ||= config[:from] unless config[:from].nil? email = from_symbol(email, ) if email.is_a? Symbol email.deliver! end |