Sha256: 4ce6423af4d02816a6fba5ab1b8e206a532605153cb5e34c7631a92a7c05183a
Contents?: true
Size: 550 Bytes
Versions: 3
Compression:
Stored size: 550 Bytes
Contents
module Pakyow class Static def initialize(app) @app = app end def call(env) if is_static?(env) Pakyow.app.response = Rack::Response.new catch(:halt) do Pakyow.app.send_file!(File.join(Configuration::Base.app.public_dir, env['PATH_INFO'])) end else @app.call(env) end end private def is_static?(env) env['PATH_INFO'] =~ /\.(.*)$/ && File.exists?(File.join(Configuration::Base.app.public_dir, env['PATH_INFO'])) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pakyow-core-0.7.2 | pakyow-core/lib/core/static.rb |
pakyow-core-0.7.1 | pakyow-core/lib/core/static.rb |
pakyow-core-0.7.0 | pakyow-core/lib/core/static.rb |