Class: HyoukiController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/hyouki_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/hyouki_controller.rb', line 4

def show
  klass = params[:class].classify.gsub(/::(\w)/) { |s| s.upcase }.constantize
  args = params[:args].split(',').collect { |a| eval(a) }
  @mail = klass.send(params[:method], *args)

  @type = params[:type] || 'plain'

  @body = if @mail.multipart?
    @mail.parts.select { |part|
      part.content_type =~ /#{@type}/
    }.first.body.to_s
  else
    @mail.body.to_s
  end
end