Class: MList::EmailServer::Base
- Inherits:
-
Object
- Object
- MList::EmailServer::Base
show all
- Defined in:
- lib/mlist/email_server/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(settings) ⇒ Base
Returns a new instance of Base.
6
7
8
9
10
11
12
13
|
# File 'lib/mlist/email_server/base.rb', line 6
def initialize(settings)
@settings = {
:domain => ::Socket.gethostname
}.merge(settings)
@uuid = UUID.new
@receivers = []
end
|
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
4
5
6
|
# File 'lib/mlist/email_server/base.rb', line 4
def settings
@settings
end
|
Instance Method Details
#deliver(tmail) ⇒ Object
15
16
17
|
# File 'lib/mlist/email_server/base.rb', line 15
def deliver(tmail)
raise 'Implement actual delivery mechanism in subclasses'
end
|
#generate_message_id ⇒ Object
19
20
21
|
# File 'lib/mlist/email_server/base.rb', line 19
def generate_message_id
"#{@uuid.generate}@#{@settings[:domain]}"
end
|
#receive(tmail) ⇒ Object
23
24
25
26
|
# File 'lib/mlist/email_server/base.rb', line 23
def receive(tmail)
email = MList::Email.new(:tmail => tmail)
@receivers.each { |r| r.receive_email(email) }
end
|
#receiver(rx) ⇒ Object
28
29
30
|
# File 'lib/mlist/email_server/base.rb', line 28
def receiver(rx)
@receivers << rx
end
|