Class: Minbox::FilePublisher
- Inherits:
-
Object
- Object
- Minbox::FilePublisher
- Defined in:
- lib/minbox/publisher.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
Instance Method Summary collapse
-
#initialize(dir = Dir.pwd) ⇒ FilePublisher
constructor
A new instance of FilePublisher.
- #publish(mail) ⇒ Object
Constructor Details
#initialize(dir = Dir.pwd) ⇒ FilePublisher
Returns a new instance of FilePublisher.
29 30 31 32 |
# File 'lib/minbox/publisher.rb', line 29 def initialize(dir = Dir.pwd) @dir = File.join(dir, 'tmp') FileUtils.mkdir_p(@dir) end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
27 28 29 |
# File 'lib/minbox/publisher.rb', line 27 def dir @dir end |
Instance Method Details
#publish(mail) ⇒ Object
34 35 36 |
# File 'lib/minbox/publisher.rb', line 34 def publish(mail) IO.write(File.join(dir, "#{Time.now.to_i}.eml"), mail.to_s) end |