Sha256: 694bd490321e1ad3ec933b20ea08befe68995a0e7e8db475610bda1e194eb70c
Contents?: true
Size: 774 Bytes
Versions: 7
Compression:
Stored size: 774 Bytes
Contents
module Maily module Generator def self.run Maily.init! fixtures = [] hooks = [] Maily::Mailer.list.each do |mailer| _hooks = [] mailer.emails_list.each do |email| if email.require_hook? fixtures << email.required_arguments _hooks << " mailer.register_hook(:#{email.name}, #{email.required_arguments.join(', ')})" end end if _hooks.present? hooks << "\nMaily.hooks_for('#{mailer.name.classify}') do |mailer|" hooks << _hooks hooks << "end" end end fixtures = fixtures.flatten.uniq.map { |f| "#{f.to_s} = ''" }.join("\n") hooks = hooks.join("\n") fixtures + "\n" + hooks + "\n" end end end
Version data entries
7 entries across 7 versions & 1 rubygems