class ServerHere::FileWrapper

Constants

ContentTypeMap

Public Class Methods

new(file) click to toggle source
# File lib/server_here/file_wrapper.rb, line 5
def initialize file
  @f = file
end

Public Instance Methods

content_type() click to toggle source
# File lib/server_here/file_wrapper.rb, line 17
def content_type
  ContentTypeMap[ext] || 'text/plain'
end
ext() click to toggle source
# File lib/server_here/file_wrapper.rb, line 13
def ext
  File.extname(@f).gsub(/\./, '')
end
last_mod() click to toggle source
# File lib/server_here/file_wrapper.rb, line 9
def last_mod
  @last_mod ||= File.mtime(@f).rfc2822
end
to_body() click to toggle source
# File lib/server_here/file_wrapper.rb, line 21
def to_body
  File.new(@f)
end