Class: Rack::Deckr
- Inherits:
-
Object
- Object
- Rack::Deckr
- Defined in:
- lib/rack/deckr.rb
Constant Summary collapse
- F =
::File
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, opts = {}) ⇒ Deckr
constructor
A new instance of Deckr.
Constructor Details
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rack/deckr.rb', line 14 def call(env) env["deckr.deck"] = ::Deckr::Deck.new(@url, @path) path = env["PATH_INFO"] return @app.call(env) unless path.start_with?(@url) path = Pathname(path).relative_path_from(Pathname(@url)) path = F.(F.join(@path, path)) return @app.call(env) unless path.start_with?(@path) && F.file?(path) file = Rack::File.new(@path) file.path = path file.serving(env) end |