Sha256: f4756332f46d86c1c82709db8279d7019f01aadaae92dc04dd376f323489447d

Contents?: true

Size: 791 Bytes

Versions: 1

Compression:

Stored size: 791 Bytes

Contents

module Rad
  module MailController
    inherit AbstractController
    
    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
          workspace = conveyors.mail.call(
            controller: mail_controller,
            method_name: m,
            arguments: args            
          )
          workspace.letter.must_be.present
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rad_core-0.0.13 lib/rad/mail/mail_controller.rb