Class: Minbox::FilePublisher

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dirObject (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