Sha256: a1def58db5d7ebec96d7f0a392d96f90c77fdeb34577836bce6608470e88ea10

Contents?: true

Size: 1011 Bytes

Versions: 24

Compression:

Stored size: 1011 Bytes

Contents

module Rad::Mailer::MailerController
  inherit Rad::Controller::Abstract

  attr_accessor :from, :to, :subject, :body

  module ClassMethods
    protected      
      inject conveyors: :conveyors
  
      def method_missing m, *args, &block
        mail_controller = self.new
        if mail_controller.respond_to? m
          build_letter mail_controller, m, *args
        else
          super
        end
      end        
    
      def build_letter mail_controller, m, *args
        conveyors.mail.must_be.present
        
        # copying parameter from current workspace if any
        # mail_workspace = rad.workspace? ? rad.workspace.clone : {}            
        # mail_workspace.merge!(
        #   controller: mail_controller,
        #   method_name: m,
        #   arguments: args
        # )

        workspace = conveyors.mail.call(
          controller: mail_controller,
          method_name: m,
          arguments: args
        )
        workspace.letter.must_be.present
      end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
rad_core-0.2.6 lib/rad/mailer/_mailer_controller.rb
rad_core-0.2.5 lib/rad/mailer/_mailer_controller.rb
rad_core-0.2.4 lib/rad/mailer/_mailer_controller.rb
rad_core-0.2.3 lib/rad/mailer/_mailer_controller.rb
rad_core-0.2.2 lib/rad/mailer/_mailer_controller.rb
rad_core-0.2.1 lib/rad/mailer/_mailer_controller.rb
rad_core-0.2.0 lib/rad/mailer/_mailer_controller.rb
rad_core-0.0.30 lib/rad/mailer/_mailer_controller.rb
rad_core-0.0.29 lib/rad/mailer/_mailer_controller.rb
rad_core-0.0.28 lib/rad/mailer/_mailer_controller.rb
rad_core-0.0.27 lib/rad/mailer/_mailer_controller.rb
rad_core-0.0.26 lib/rad/mailer/_mailer_controller.rb
rad_core-0.0.25 lib/rad/mailer/_mailer_controller.rb
rad_core-0.0.24 lib/rad/mailer/_mailer_controller.rb
rad_core-0.0.23 lib/rad/mailer/_mailer_controller.rb
rad_core-0.0.22 lib/rad/mailer/_mailer_controller.rb
rad_core-0.0.21 lib/rad/mailer/_mailer_controller.rb
rad_core-0.0.20 lib/rad/mailer/_mailer_controller.rb
rad_core-0.0.19 lib/rad/mailer/_mailer_controller.rb
rad_core-0.0.18 lib/rad/mailer/_mailer_controller.rb