Class: EmailInviter

Inherits:
Object
  • Object
show all
Defined in:
lib/email_inviter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(emails, inviter, options = {}) ⇒ EmailInviter

Returns a new instance of EmailInviter.


6
7
8
9
10
11
# File 'lib/email_inviter.rb', line 6

def initialize(emails, inviter, options={})
  options = options.symbolize_keys
  self.locale = options.fetch(:locale, 'en')
  self.inviter = inviter
  self.emails = emails
end

Instance Attribute Details

#emailsObject

Returns the value of attribute emails


4
5
6
# File 'lib/email_inviter.rb', line 4

def emails
  @emails
end

#inviterObject

Returns the value of attribute inviter


4
5
6
# File 'lib/email_inviter.rb', line 4

def inviter
  @inviter
end

#localeObject

Returns the value of attribute locale


4
5
6
# File 'lib/email_inviter.rb', line 4

def locale
  @locale
end

Instance Method Details

#invitation_codeObject


19
20
21
# File 'lib/email_inviter.rb', line 19

def invitation_code
  @invitation_code ||= inviter.invitation_code
end

#send!Object


23
24
25
# File 'lib/email_inviter.rb', line 23

def send!
  self.emails.each{ |email| mail(email)}
end