Module: RhizMail

Defined in:
lib/rhizmail.rb

Defined Under Namespace

Classes: InvalidStateError, Mailer, Message, MockMailer, SimpleTemplateMessage

Constant Summary collapse

Version =
'0.1.5'

Class Method Summary collapse

Class Method Details

.mock=(maybe_mock) ⇒ Object

Sets RhizMail to run using mocks for use in testing. Calling RhizMail.mock = true sets the Mailer to use MockMailer instead.



55
56
57
58
59
60
61
# File 'lib/rhizmail.rb', line 55

def self.mock=( maybe_mock )
	if maybe_mock and Mailer.get_mailer.is_a?( Mailer )
		Mailer.set_mailer MockMailer.new
	elsif !maybe_mock and Mailer.get_mailer.is_a?( MockMailer )
		ContextualService::Context.instance.set_resource( Mailer, nil )
	end
end

.valid_address?(address) ⇒ Boolean

Returns a boolean value describing whether address is a plausible email address format.

Returns:

  • (Boolean)


65
# File 'lib/rhizmail.rb', line 65

def self.valid_address?(address); (address =~ /\w@\S*\./) != nil; end