Sha256: 6f9113dc8df4e7d0394a44b3e2bbabd6885cc06cfa30c5c67ab8a49793ce350e

Contents?: true

Size: 356 Bytes

Versions: 3

Compression:

Stored size: 356 Bytes

Contents

require 'rack'

module Rail
  class Browser
    attr_reader :root

    def initialize(config)
      @root = File.join(config.root, 'public')
      @directory = Rack::Directory.new(root)
    end

    def process(request)
      @directory.call(request.env)
    end

    def accept?(request)
      File.exist?(File.join(root, request.path))
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rail-0.1.1 lib/rail/browser.rb
rail-0.1.0 lib/rail/browser.rb
rail-0.0.8 lib/rail/browser.rb