Class: Store
Overview
Message storage
Instance Attribute Summary collapse
-
#messages ⇒ Object
Returns the value of attribute messages.
Instance Method Summary collapse
-
#add(mail_from, rcpt_to, message_data) ⇒ Object
Saves message in storage.
-
#get ⇒ Object
Returns array of messages.
-
#initialize ⇒ Store
constructor
A new instance of Store.
-
#remove(index) ⇒ Object
Removes message from storage.
-
#truncate ⇒ Object
Remove empty messages.
Constructor Details
#initialize ⇒ Store
Returns a new instance of Store.
10 11 12 |
# File 'lib/store.rb', line 10 def initialize self. = [] end |
Instance Attribute Details
#messages ⇒ Object
Returns the value of attribute messages.
8 9 10 |
# File 'lib/store.rb', line 8 def @messages end |
Instance Method Details
#add(mail_from, rcpt_to, message_data) ⇒ Object
Saves message in storage
20 21 22 |
# File 'lib/store.rb', line 20 def add(mail_from, rcpt_to, ) .push end |
#get ⇒ Object
Returns array of messages
15 16 17 |
# File 'lib/store.rb', line 15 def get return end |
#remove(index) ⇒ Object
Removes message from storage
25 26 27 |
# File 'lib/store.rb', line 25 def remove(index) self.[index] = nil end |
#truncate ⇒ Object
Remove empty messages
30 31 32 |
# File 'lib/store.rb', line 30 def truncate self. = self..reject{ || .nil? } end |