Sha256: 8f60d7047ab33d93ec8ae03900bafbb17f75689ecfb35964fd472969727bf5ce

Contents?: true

Size: 388 Bytes

Versions: 2

Compression:

Stored size: 388 Bytes

Contents

require 'server_here/content_type_map'

module ServerHere
  class FileWrapper
    def initialize file
      @f = file
    end
  
    def last_mod
      @last_mod ||= File.mtime(@f).rfc2822
    end
  
    def ext
      File.extname(@f).gsub(/\./, '')
    end
  
    def content_type
      ContentTypeMap[ext] || 'text/plain'
    end
  
    def to_body
      File.new(@f)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
server_here-0.1.2 lib/server_here/file_wrapper.rb
server_here-0.1.1 lib/server_here/file_wrapper.rb