class File
Public Instance Methods
content_type()
click to toggle source
# File lib/bolt/serve.rb, line 16 def content_type mime = {'.jpeg' => 'image/jpeg', '.jpg' => 'image/jpeg', '.png' => 'image/png', '.gif' => 'image/gif', '.mp3' => 'audio/mpeg3', '.aif' => 'audio/aiff', '.mid' => 'audio/midi', '.wav' => 'audio/wav', '.m4a' => 'audio/MP4A-LATM', '.3gp' => 'video/3gpp', '.dv' => 'video/DV', '.mp4' => 'video/H264', '.pdf' => 'application/pdf', '.js' => 'application/js', '.json' => 'application/json', '.xml' => 'text/xml', '.html' => 'text/html', '.htm' => 'text/htm', '.css' => 'text/css', '.txt' => 'text/plain'} mime[File.extname(self.path)] || 'application/octet-stream' end
to_s()
click to toggle source
# File lib/bolt/serve.rb, line 30 def to_s s = "" self.each {|line| s += line} s end