Class: Hyper::Static

Inherits:
Object
  • Object
show all
Defined in:
lib/hyper/static.rb

Class Method Summary collapse

Instance Method Summary collapse

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

.urlsObject



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