module Maily
Constants
- VERSION
Attributes
allow_delivery[RW]
allow_edition[RW]
available_locales[RW]
base_controller[RW]
enabled[RW]
hooks_path[RW]
welcome_message[RW]
Public Class Methods
allowed_action?(action)
click to toggle source
# File lib/maily.rb, line 47 def allowed_action?(action) case action.to_sym when :edit allow_edition when :update allow_edition && !Rails.env.production? when :deliver allow_delivery end end
hooks_for(mailer_name) { |mailer| ... }
click to toggle source
# File lib/maily.rb, line 35 def hooks_for(mailer_name) mailer_name = mailer_name.underscore mailer = Maily::Mailer.find(mailer_name) || Maily::Mailer.new(mailer_name) yield(mailer) if block_given? end
init!()
click to toggle source
# File lib/maily.rb, line 12 def init! self.enabled = !Rails.env.production? self.allow_edition = !Rails.env.production? self.allow_delivery = !Rails.env.production? self.available_locales = Rails.application.config.i18n.available_locales || I18n.available_locales self.base_controller = 'ActionController::Base' self.http_authorization = nil self.hooks_path = "lib/maily_hooks.rb" self.welcome_message = nil end
load_emails_and_hooks()
click to toggle source
# File lib/maily.rb, line 23 def load_emails_and_hooks # Load emails from file system Dir[Rails.root + 'app/mailers/*.rb'].each do |mailer| klass_name = File.basename(mailer, '.rb') Maily::Mailer.new(klass_name) end # Load hooks hooks_file_path = File.join(Rails.root, hooks_path) require hooks_file_path if File.exist?(hooks_file_path) end
setup() { |self| ... }
click to toggle source
# File lib/maily.rb, line 42 def setup init! yield(self) if block_given? end