Sha256: 05c838f609567a229cb607f674fbc4c31ce093958c2ce5a63869c379a7d31e9f
Contents?: true
Size: 837 Bytes
Versions: 4
Compression:
Stored size: 837 Bytes
Contents
module Maily class Mailer cattr_accessor :collection attr_accessor :name, :emails def initialize(name, methods) self.collection ||= [] self.name = name self.emails = self.class.build_emails(methods, name) self.collection << self end def self.all Maily.load_emails_and_hooks if collection.nil? collection end def self.find(mailer_name) all.find { |mailer| mailer.name == mailer_name } end def self.build_emails(methods, mailer) methods.map do |email| Maily::Email.new(email, mailer) end end def register_hook(email_name, *args) email = find_email(email_name) email.register_hook(args) end def find_email(email_name) emails.find { |email| email.name == email_name.to_s } end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
maily-0.4.0 | lib/maily/mailer.rb |
maily-0.3.5 | lib/maily/mailer.rb |
maily-0.3.4 | lib/maily/mailer.rb |
maily-0.3.3 | lib/maily/mailer.rb |