Class: Mail::SingleFileDelivery::Agent
- Inherits:
-
Object
- Object
- Mail::SingleFileDelivery::Agent
- Defined in:
- lib/mail-single_file_delivery.rb
Instance Attribute Summary collapse
-
#settings ⇒ Object
Returns the value of attribute settings.
Instance Method Summary collapse
- #deliver!(mail) ⇒ Object
-
#initialize(settings = {}) ⇒ Agent
constructor
A new instance of Agent.
Constructor Details
#initialize(settings = {}) ⇒ Agent
Returns a new instance of Agent.
8 9 10 11 12 13 14 |
# File 'lib/mail-single_file_delivery.rb', line 8 def initialize(settings={}) self.settings = {:filename => '/tmp/mail-single_file'}.merge! settings filename = self.settings[:filename] mode = File.pipe?(filename) ? 'a+' : 'w' @fd = File.open(filename, mode) \ or raise "Cannot open #{filename} for writing" # just being safe end |
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
6 7 8 |
# File 'lib/mail-single_file_delivery.rb', line 6 def settings @settings end |
Instance Method Details
#deliver!(mail) ⇒ Object
16 17 18 19 |
# File 'lib/mail-single_file_delivery.rb', line 16 def deliver!(mail) @fd.write mail.encoded + "\r\n\r\n" @fd.flush end |