Class: Mathjax::Rails::MathjaxRailsController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/mathjax/rails/controllers.rb

Instance Method Summary collapse

Instance Method Details

#giveOutStaticFileObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/mathjax/rails/controllers.rb', line 2

def giveOutStaticFile
  ext = ''
  ext = ".#{params[:format]}" if params[:format]
  filename = params[:uri]+ext
  filepath = "../../../../vendor/#{Mathjax::Rails::DIRNAME}/es5/#{filename}"

  extname = File.extname(filename)[1..-1]
  mime_type = Mime::Type.lookup_by_extension(extname)
  options = Hash.new
  options[:type] = mime_type.to_s unless mime_type.nil?
  options[:disposition] = 'inline'
  file = File.expand_path(filepath, __FILE__)
  if File.exist?(file)
    send_file file, options
  else
    raise ActionController::RoutingError.new('')
  end
end

#verify_authenticity_tokenObject



21
22
# File 'lib/mathjax/rails/controllers.rb', line 21

def verify_authenticity_token
end