Class: Hyper::Static
- Inherits:
-
Object
- Object
- Hyper::Static
- Defined in:
- lib/hyper/static.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Static
constructor
A new instance of Static.
Constructor Details
#initialize(app) ⇒ Static
Returns a new instance of Static.
13 14 15 16 17 18 |
# File 'lib/hyper/static.rb', line 13 def initialize(app) @app = Rack::Builder.new do use Rack::Static, :urls => Hyper::Static.urls, :root => 'public' run app end end |
Class Method Details
.urls ⇒ Object
6 7 8 9 10 |
# File 'lib/hyper/static.rb', line 6 def urls Dir[Hyper.root.join('public/**/*')].map do |file| file.sub(Hyper.root.join('public').to_s, '') end end |
Instance Method Details
#call(env) ⇒ Object
20 21 22 |
# File 'lib/hyper/static.rb', line 20 def call(env) @app.call(env) end |