Module: MandrillQueue::Message::Recipients::DSL

Included in:
Internal
Defined in:
lib/mandrill_queue/message/recipients.rb

Overview

Define DSL for inclusion in remote classes

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.include_as(base, name) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/mandrill_queue/message/recipients.rb', line 13

def self.include_as(base, name)
	base.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{name}(email = nil, name = nil, name_field = nil, &block)
	recipients.dsl(email, name, name_field, :#{name}, &block) if !email.nil? || block_given?
	block_given? ? self : recipients
end
	RUBY
end

.included(base) ⇒ Object



22
23
24
25
26
# File 'lib/mandrill_queue/message/recipients.rb', line 22

def self.included(base)
	[:to, :cc, :bcc].each do |x|
		include_as(base, x)
	end
end

Instance Method Details

#recipientsObject



9
10
11
# File 'lib/mandrill_queue/message/recipients.rb', line 9

def recipients
	@_recipients ||= Recipients.new
end