Class: Mailpeek::MailController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Mailpeek::MailController
- Defined in:
- app/controllers/mailpeek/mail_controller.rb
Overview
Public: MailController
Instance Method Summary collapse
Instance Method Details
#destroy ⇒ Object
12 13 14 15 16 17 18 |
# File 'app/controllers/mailpeek/mail_controller.rb', line 12 def destroy email = @emails[params[:id]] File.delete("#{directory}/#{params[:id]}") if email head :ok end |
#destroy_all ⇒ Object
20 21 22 23 24 25 26 |
# File 'app/controllers/mailpeek/mail_controller.rb', line 20 def destroy_all @emails.each do |file, _| File.delete("#{directory}/#{file}") end head :ok end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/mailpeek/mail_controller.rb', line 8 def index @emails = @emails.sort.reverse.to_h end |