Class: FileMessageObserver
- Inherits:
-
Object
- Object
- FileMessageObserver
- Includes:
- FileUtils
- Defined in:
- lib/message_observers.rb
Instance Method Summary collapse
-
#initialize(message_directory, system_time = SystemTime.new) ⇒ FileMessageObserver
constructor
A new instance of FileMessageObserver.
- #update(message_string) ⇒ Object
Constructor Details
#initialize(message_directory, system_time = SystemTime.new) ⇒ FileMessageObserver
Returns a new instance of FileMessageObserver.
9 10 11 12 13 |
# File 'lib/message_observers.rb', line 9 def initialize(, system_time = SystemTime.new) @message_directory = @system_time = system_time mkdir_p() end |
Instance Method Details
#update(message_string) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/message_observers.rb', line 15 def update() mail = Mail.read_from_string() file_name = File.join(@message_directory, "#{@system_time.current_time_in_seconds}_#{mail.to.first}.txt") File.open(file_name, 'w') {|file| file << } end |